ST_ENVELOPE()
All functions > GEOSPATIAL > ST_ENVELOPE()
Returns the bounding box of a geometry as a polygon.
Signatures
Envelope / bounding box
Returns: Bounding box as a polygon
ST_ENVELOPE(geo: T) → Polygon sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY
Signature notes:
- The vertex layout of the result (start vertex, ring orientation, order of parts) is engine-defined: compare two results with ST_EQUALS, not their WKT
- GEOMETRY only: GEOGRAPHY has no spherical form here; convert with ST_TOGEOMETRY for a planar answer
- Returns the minimum axis aligned bounding rectangle
- For a Point, returns a degenerate polygon (or the point itself depending on engine)
- On BigQuery: transpiled to ST_BOUNDINGBOX
- Returns NULL if the input is NULL
Availability
| Status | Backends |
|---|---|
| Not available | clickhouse, bigquery, mysql |
Examples
FeatureQL
RETURN
-- Bounding box of a diagonal line
f1 := ST_ASTEXT(ST_ENVELOPE(ST_GEOMFROMTEXT('LINESTRING (0 0, 3 4)')))
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 3 0, 3 4, 0 4, 0 0)) |