- Categories:
ST_ENVELOPE¶
Returns the minimum bounding box (a rectangular “envelope”) that encloses a specified GEOGRAPHY or GEOMETRY object.
Syntax¶
Arguments¶
geography_or_geometry_expressionThe argument must be of type GEOGRAPHY or GEOMETRY.
Returns¶
The function returns a value of type GEOGRAPHY or GEOMETRY that represents the minimum bounding box around the input object.
Usage notes¶
For GEOGRAPHY objects:
If
geography_expressionis a LineString that represents a meridian arc (an arc along a line of longitude), ST_ENVELOPE returns that LineString.If
geography_expressionis a LineString that represents an arc on a parallel (an arc along a line of latitude) other than the equator, ST_ENVELOPE returns a Polygon that represents the bounding box for the arc.If
geography_expressionis a single Point, ST_ENVELOPE returns that Point.
For GEOMETRY objects:
In degenerate cases (e.g. where the input is a point or a vertical or horizontal line), the function may return a geometry of lower dimension (i.e. a Point or LineString).
For GEOMETRY objects, the returned GEOMETRY object has the same SRID as the input.
Examples¶
GEOGRAPHY examples¶
The following example returns the minimum bounding box for a polygon:
The following example passes in a LineString that represents a meridian arc. The function returns the same LineString, rather than a Polygon.
The following example passes in a LineString that represents an arc on a parallel that is not the equator. The function returns a Polygon that represents the bounding box:
The following example passes in a single Point. The function returns the same Point: