ST_Envelope — Returns a geometry object representing the minimum bounding box for the supplied Geometry.
geometry ST_Envelope(bytea
Geometry);
Returns a Polygon that represents the rectangle bounding for the input geometry. This Polygon is defined by the corner points of the bounding box [(MINX, MINY),(MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].
Jaspa also interpolates Z coordinate.
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | - |
| OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
|---|---|---|---|
| 2.1.1.1 | 7.2.10.1 | 7.2.8.2 | 5.1.15 |
--POINT
SELECT ST_AsEWKT(ST_Envelope(ST_GeomFromText('POINT (0 0)')));
st_asewkt
-------------------------------------
POLYGON ((0 0, 0 0, 0 0, 0 0, 0 0))
(1 row)
--LINESTRING
SELECT ST_AsEWKT(ST_Envelope(ST_GeomFromText('LINESTRING(10 50 50,10 20 55,10 0 50)')));
st_asewkt
-----------------------------------------------------------
POLYGON ((10 0 50, 10 50 55, 10 50 55, 10 0 50, 10 0 50))
(1 row)
--POLYGON
SELECT ST_AsEWKT(ST_Envelope(ST_GeomFromText('POLYGON ((20 20 10 10, 50 30 10 10, 20 50 -4 2, 20 20 4 2))')));
st_asewkt
--------------------------------------------------------------
POLYGON ((20 20 -4, 20 50 10, 50 50 10, 50 20 -4, 20 20 -4))
(1 row)