ArcGIS Server Banner

ST_Envelope

ST_Envelope

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_Envelope returns the bounding box of a geometry object as a polygon.

Syntax

Oracle

sde.st_envelope (g1 sde.st_geometry)

PostgreSQL

st_envelope (g1 st_geometry)

Return type

ST_Geometry

Example

The envelope_test table's geotype column stores the name of the geometry subclass stored in the g1 ST_Geometry column.

Oracle

CREATE TABLE envelope_test (geotype varchar(20), g1 sde.st_geometry);

The INSERT statements insert each geometry subclass into the envelope_test table.

INSERT INTO envelope_test VALUES (
'Point',
sde.st_pointfromtext ('point (10.02 20.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
sde.st_linefromtext ('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Polygon',
sde.st_polyfromtext ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipoint',
sde.st_mpointfromtext ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
sde.st_mlinefromtext ('multilinestring ((10.01 20.01, 20.01 20.01, 30.01 20.01), (30.01 20.01, 40.01 20.01, 50.01 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipolygon',
sde.st_mpolyfromtext ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

PostgreSQL

CREATE TABLE envelope_test (geotype varchar(20), g1 st_geometry);

The INSERT statements insert each geometry subclass into the envelope_test table.

INSERT INTO envelope_test VALUES (
'Point',
st_point ('point (10.02 20.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
st_linestring ('linestring (10.01 20.01, 10.01 30.01, 10.01 40.01)', 0)
);

INSERT INTO envelope_test VALUES (
'Linestring',
st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Polygon',
st_polygon ('polygon ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipoint',
st_multipoint ('multipoint (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
st_multilinestring ('multilinestring ((10.01 20.01, 20.01 20.01, 30.01 20.01), (30.01 20.01, 40.01 20.01, 50.01 20.01))', 0)
);

INSERT INTO envelope_test VALUES (
'Multilinestring',
st_multilinestring ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0)
);

INSERT INTO envelope_test VALUES (
'Multipolygon',
st_multipolygon ('multipolygon (((10.02 20.01, 11.92 35.64, 25.02 34.15,
19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87,
52.43 31.90, 51.71 21.73)))', 0)
);

The query lists the subclass name and its envelope. The ST_Envelope function returns the envelope around a point, line, or polygon.

Oracle

SELECT geotype, sde.st_astext (sde.st_envelope (g1)) Envelope
FROM envelope_test;

GEOTYPE      Envelope

Point           POLYGON  (( 9.02000000 9.02000000, 21.01000000
9.02000000, 21.01000000 21.01000000, 9.02000000 
21.01000000, 9.02000000 9.02000000))
Linestring    POLYGON  (( 9.01000000 19.01000000, 11.01000000
 19.01000000, 11.01000000 41.01000000, 9.01000000
 41.01000000, 9.01000000 19.01000000))
Linestring    POLYGON  (( 10.02000000 10.02000000,
 11.92000000 20.01000000, 11.92000000 25.64000000, 
10.02000000 25.64000000, 10.02000000 10.02000000))
Polygon      POLYGON  (( 10.02000000 20.01000000,
 25.02000000 20.01000000, 25.02000000 35.64000000, 
10.02000000 35.64000000, 10.02000000 20.01000000))
Multipoint      POLYGON  (( 10.02000000 20.01000000,
 11.92000000 20.01000000, 11.92000000 25.64000000,
10.02000000 25.64000000, 10.02000000 20.01000000))
Multilinestring POLYGON  (( 9.01000000 19.01000000,
 51.01000000 19.01000000, 51.01000000 21.01000000,
9.01000000 21.01000000,  9.01000000 19.01000000))
Multilinestring POLYGON  (( 9.55000000 20.01000000,
 15.36000000 20.01000000, 15.36000000 30.11000000,
9.55000000 30.11000000, 9.55000000 20.01000000))
Multipolygon   POLYGON  (( 10.02000000 20.01000000,
 73.36000000 20.01000000, 73.36000000 35.64000000,
10.02000000 35.64000000, 10.02000000 20.01000000)) 

PostgreSQL

SELECT geotype, st_astext (st_envelope (g1)) AS Envelope
FROM envelope_test;

geotype     envelope

Point           POLYGON  (( 9.02000000 9.02000000, 21.01000000
9.02000000, 21.01000000 21.01000000, 9.02000000 
21.01000000, 9.02000000 9.02000000))
Linestring    POLYGON  (( 9.01000000 19.01000000, 11.01000000
 19.01000000, 11.01000000 41.01000000, 9.01000000
 41.01000000, 9.01000000 19.01000000))
Linestring    POLYGON  (( 10.02000000 10.02000000,
 11.92000000 20.01000000, 11.92000000 25.64000000, 
10.02000000 25.64000000, 10.02000000 10.02000000))
Polygon      POLYGON  (( 10.02000000 20.01000000,
 25.02000000 20.01000000, 25.02000000 35.64000000, 
10.02000000 35.64000000, 10.02000000 20.01000000))
Multipoint      POLYGON  (( 10.02000000 20.01000000,
 11.92000000 20.01000000, 11.92000000 25.64000000,
10.02000000 25.64000000, 10.02000000 20.01000000))
Multilinestring POLYGON  (( 9.01000000 19.01000000,
 51.01000000 19.01000000, 51.01000000 21.01000000,
9.01000000 21.01000000,  9.01000000 19.01000000))
Multilinestring POLYGON  (( 9.55000000 20.01000000,
 15.36000000 20.01000000, 15.36000000 30.11000000,
9.55000000 30.11000000, 9.55000000 20.01000000))
Multipolygon   POLYGON  (( 10.02000000 20.01000000,
 73.36000000 20.01000000, 73.36000000 35.64000000,
10.02000000 35.64000000, 10.02000000 20.01000000)) 

See Also

  • An overview of SQL functions used with ST_Geometry types