Appearance
ST_ENVELOPE
Returns a double-precision minimum bounding box for the supplied geography. The polygon is defined by the corner points ((MINX, MINY), (MINX, MAXY), (MAXX, MAXY), (MAXX, MINY), (MINX, MINY)).
For degenerate cases (e.g.: vertical lines or points), returns a GEOGRAPHY of a lower dimension (POINT or LINESTRING).
Syntax
sql
ST_ENVELOPE(<input>)Arguments
<input>: AGEOGRAPHYobject to calculate the envelope
Returns
A GEOGRAPHY representing the bounding box. Return type depends on input:
- For most cases: returns a
POLYGONdefined by the corner points - For vertical lines or horizontal lines: returns a
LINESTRING - For points: returns a
POINT
Example
sql
SELECT ST_AsText(ST_Envelope('LINESTRING(0 0, 1 1, 2 2)'::GEOGRAPHY));
-- POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))
SELECT ST_AsText(ST_Envelope('POINT(1 1)'::GEOGRAPHY));
-- POINT(1 1)