Name

ST_Envelope — Returns a geometry object representing the minimum bounding box for the supplied Geometry.

Synopsis

geometry ST_Envelope(bytea Geometry);

Alias

Envelope

Description

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.

Coordinate Dimensions
2D3DM

-

Spatial Standards Support
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.17.2.10.17.2.8.25.1.15

Examples

--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)

Related functions

ST_Box2D,ST_Box3D,ST_Extent