ST_Envelope

Definition

ST_Envelope gibt das kleinste umgebende Rechteck eines Geometrieobjekts als Polygon zurück.

DetailinformationenDetailinformationen:

Diese Funktion entspricht der Simple Features-Spezifikation von Open Geospatial Consortium, Inc. (OGC), die besagt, dass ST_Envelope ein Polygon zurückgibt. Bei der Arbeit mit Sonderfällen von Punktgeometrien oder horizontalen und vertikalen Linien gibt die Funktion "ST_Envelope" ein Polygon zurück, das diese Formen umschließt. Dabei handelt es sich um die Toleranz eines kleinen Envelopes, die mit dem XY-Maßstabsfaktor für das Raumbezugssystem der Geometrie berechnet wird. Diese Toleranz wird von den minimalen X- und Y-Koordinaten subtrahiert und den maximalen X- und Y-Koordinaten hinzugefügt, damit das Polygon zurückgegeben wird, das diese Shapes umschließt.

Syntax

Oracle und PostgreSQL

sde.st_envelope (geometry1 sde.st_geometry)

SQLite

st_envelope (geometry1 geometryblob)

Rückgabetyp

Oracle und PostgreSQL

ST_Geometry

SQLite

Geometryblob

Beispiel

In der Spalte "geotype" der Tabelle "envelope_test" wird der Name der Geometrie-Subclass gespeichert, die in der Spalte "g1" enthalten ist. Mit der INSERT-Anweisung wird jede Geometrie-Subclass in die Tabelle "envelope_test" eingefügt.

Als nächstes wird die Funktion "ST_Envelope" ausgeführt, um den Polygon-Envelope zurückzugeben, der die Geometrie umschließt.

Oracle

--Create table and insert values.
CREATE TABLE envelope_test (
 geotype varchar(20),
 g1 sde.st_geometry
);

INSERT INTO ENVELOPE_TEST VALUES (
'Point',
sde.st_geometry ('point (-1509734.232 -36684.757)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Linestring',
sde.st_geometry ('linestring (-1511144.181 -37680.015, -1509734.232 -38841.149, -1508656.036 -39753.469)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Polygon',
sde.st_geometry ('polygon ((-1506333.768 -36435.943, -1504343.252 -36767.695, -1502684.489 -35357.747, -1506333.768 -36435.943))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipoint',
sde.st_geometry ('multipoint (-1493229.539 -40665.789, -1494141.859 -40831.665, -1495800.622 -42739.242)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multilinestring',
sde.st_geometry ('multilinestring ((-1504757.943 -33201.355, -1507411.964 -35606.561), (-1502518.613 -38094.706, -1499781.653 -37099.448, -1498952.272 -34694.241))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipolygon',
sde.st_geometry ('multipolygon (((-1492068.405 -47300.841, -1492814.848 -45725.016, -1493975.983 -46471.459,
-1493478.354 -47798.47, -1492068.405 -47300.841), (-1497874.076 -48047.284, -1498537.581 -50618.367, -1497210.571 -50037.8,
-1497874.076 -48047.284)))', 102004)
);
--Return the polygon envelope around each geometry in well-known text.
SELECT geotype geometry_type,
 sde.st_astext (sde.st_envelope (g1)) envelope
 FROM ENVELOPE_TEST;

GEOMETRY_TYPE    ENVELOPE
 
Point           |POLYGON (( -1509734.23220000 -36684.75720000, -1509734.23180000 -36684.75720000, 
-1509734.23180000 -36684.75680000, -1509734.23220000 -36684.75680000, -1509734.23220000 -36684.75720000))

Linestring      |POLYGON (( -1511144.18100000 -39753.46900000, -1508656.03600000 -39753.46900000, 
-1508656.03600000 -37680.01500000, -1511144.18100000 -37680.01500000, -1511144.18100000 -39753.46900000))

Polygon         |POLYGON (( -1506333.76800000 -36767.69500000, -1502684.48900000 -36767.69500000, 
-1502684.48900000 -35357.74700000, -1506333.76800000 -35357.74700000, -1506333.76800000 -36767.69500000))

Multipoint      |POLYGON (( -1495800.62200000 -42739.24200000, -1493229.53900000 -42739.24200000, 
-1493229.53900000 -40665.78900000, -1495800.62200000 -40665.78900000, -1495800.62200000 -42739.24200000))

Multilinestring |POLYGON (( -1507411.96400000 -38094.70600000, -1498952.27200000 -38094.70600000, 
-1498952.27200000 -33201.35500000, -1507411.96400000 -33201.35500000, -1507411.96400000 -38094.70600000))

Multipolygon    |POLYGON (( -1498537.58100000 -50618.36700000, -1492068.40500000 -50618.36700000, 
-1492068.40500000 -45725.01600000, -1498537.58100000 -45725.01600000, -1498537.58100000 -50618.36700000))

PostgreSQL

--Create table and insert values.
CREATE TABLE envelope_test (
 geotype varchar(20),
 g1 sde.st_geometry
);

INSERT INTO ENVELOPE_TEST VALUES (
'Point',
sde.st_geometry ('point (-1509734.232 -36684.757)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Linestring',
sde.st_geometry ('linestring (-1511144.181 -37680.015, -1509734.232 -38841.149, -1508656.036 -39753.469)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Polygon',
sde.st_geometry ('polygon ((-1506333.768 -36435.943, -1504343.252 -36767.695, -1502684.489 -35357.747, -1506333.768 -36435.943))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipoint',
sde.st_geometry ('multipoint (-1493229.539 -40665.789, -1494141.859 -40831.665, -1495800.622 -42739.242)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multilinestring',
sde.st_geometry ('multilinestring ((-1504757.943 -33201.355, -1507411.964 -35606.561), (-1502518.613 -38094.706, -1499781.653 -37099.448, -1498952.272 -34694.241))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
'Multipolygon',
sde.st_geometry ('multipolygon (((-1492068.405 -47300.841, -1492814.848 -45725.016, -1493975.983 -46471.459,
-1493478.354 -47798.47, -1492068.405 -47300.841), (-1497874.076 -48047.284, -1498537.581 -50618.367, -1497210.571 -50037.8,
-1497874.076 -48047.284)))', 102004)
);
--Return the polygon envelope around each geometry in well-known text.
SELECT geotype AS geometry_type, 
 sde.st_astext (sde.st_envelope (g1)) AS Envelope
 FROM envelope_test;

geometry_type     envelope

"Point"           |"POLYGON (( -1509734.23220000 -36684.75720000, -1509734.23180000 -36684.75720000, 
-1509734.23180000 -36684.75680000, -1509734.23220000 -36684.75680000, -1509734.23220000 -36684.75720000))"

"Linestring"      |"POLYGON (( -1511144.18100000 -39753.46900000, -1508656.03600000 -39753.46900000, 
-1508656.03600000 -37680.01500000, -1511144.18100000 -37680.01500000, -1511144.18100000 -39753.46900000))"

"Polygon"         |"POLYGON (( -1506333.76800000 -36767.69500000, -1502684.48900000 -36767.69500000, 
-1502684.48900000 -35357.74700000, -1506333.76800000 -35357.74700000, -1506333.76800000 -36767.69500000))"

"Multipoint"      |"POLYGON (( -1495800.62200000 -42739.24200000, -1493229.53900000 -42739.24200000, 
-1493229.53900000 -40665.78900000, -1495800.62200000 -40665.78900000, -1495800.62200000 -42739.24200000))"

"Multilinestring" |"POLYGON (( -1507411.96400000 -38094.70600000, -1498952.27200000 -38094.70600000, 
-1498952.27200000 -33201.35500000, -1507411.96400000 -33201.35500000, -1507411.96400000 -38094.70600000))"

"Multipolygon"    |"POLYGON (( -1498537.58100000 -50618.36700000, -1492068.40500000 -50618.36700000, 
-1492068.40500000 -45725.01600000, -1498537.58100000 -45725.01600000, -1498537.58100000 -50618.36700000))"

SQLite

--Create table and insert values.
CREATE TABLE envelope_test (
 geotype varchar(20)
);

SELECT AddGeometryColumn (
 NULL,
 'envelope_test',
 'g1',
 4326,
 'geometry',
 'xy',
 'null'
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Point',
 st_geometry ('point (-1509734.232 -36684.757)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Linestring',
 st_geometry ('linestring (-1511144.181 -37680.015, -1509734.232 -38841.149, -1508656.036 -39753.469)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Polygon',
 st_geometry ('polygon ((-1506333.768 -36435.943, -1504343.252 -36767.695, -1502684.489 -35357.747, -1506333.768 -36435.943))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Multipoint',
 st_geometry ('multipoint (-1493229.539 -40665.789, -1494141.859 -40831.665, -1495800.622 -42739.242)', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Multilinestring',
 st_geometry ('multilinestring ((-1504757.943 -33201.355, -1507411.964 -35606.561), (-1502518.613 -38094.706, -1499781.653 -37099.448, -1498952.272 -34694.241))', 102004)
);

INSERT INTO ENVELOPE_TEST VALUES (
 'Multipolygon',
 st_geometry ('multipolygon (((-1492068.405 -47300.841, -1492814.848 -45725.016, -1493975.983 -46471.459,
-1493478.354 -47798.47, -1492068.405 -47300.841), (-1497874.076 -48047.284, -1498537.581 -50618.367, -1497210.571 -50037.8,
-1497874.076 -48047.284)))', 102004)
);
--Return the polygon envelope around each geometry in well-known text.
SELECT geotype AS geometry_type, 
 st_astext (st_envelope (g1)) AS "Envelope"
 FROM envelope_test;

geometry_type   Envelope

Point           POLYGON (( -1509734.23220000 -36684.75720000, -1509734.23180000 -36684.75720000, 
-1509734.23180000 -36684.75680000, -1509734.23220000 -36684.75680000, -1509734.23220000 -36684.75720000))

Linestring      POLYGON (( -1511144.18100000 -39753.46900000, -1508656.03600000 -39753.46900000, 
-1508656.03600000 -37680.01500000, -1511144.18100000 -37680.01500000, -1511144.18100000 -39753.46900000))

Polygon         POLYGON (( -1506333.76800000 -36767.69500000, -1502684.48900000 -36767.69500000, 
-1502684.48900000 -35357.74700000, -1506333.76800000 -35357.74700000, -1506333.76800000 -36767.69500000))

Multipoint      POLYGON (( -1495800.62200000 -42739.24200000, -1493229.53900000 -42739.24200000, 
-1493229.53900000 -40665.78900000, -1495800.62200000 -40665.78900000, -1495800.62200000 -42739.24200000))

Multilinestring POLYGON (( -1507411.96400000 -38094.70600000, -1498952.27200000 -38094.70600000, 
-1498952.27200000 -33201.35500000, -1507411.96400000 -33201.35500000, -1507411.96400000 -38094.70600000))

Multipolygon    POLYGON (( -1498537.58100000 -50618.36700000, -1492068.40500000 -50618.36700000, 
-1492068.40500000 -45725.01600000, -1498537.58100000 -45725.01600000, -1498537.58100000 -50618.36700000))

Verwandte Themen

5/10/2014