ST_ENVELOPE()
All functions > GEOSPATIAL > ST_ENVELOPE()
Returns the bounding box of a geometry or geography 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 or geography value |
With:
T: Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY
Signature notes:
- 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
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_ENVELOPE(ST_GEOMFROMTEXT('LINESTRING (0 0, 3 4)'))) -- Bounding box of a diagonal line (vertex order follows DuckDB spatial)
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 3 0, 3 4, 0 4, 0 0)) |
On this page