ST_EXTENT()
All functions > GEOSPATIAL > ST_EXTENT()
Aggregate function that returns the bounding box of all geometries in a group as a polygon.
Signatures
Extent
Returns: Axis-aligned bounding rectangle enclosing all input geometries
ST_EXTENT(geo: T) → GEOM_POLYGON sql
| Parameter | Type | Required | Description |
|---|---|---|---|
geo | T | Yes | Geometry column to aggregate |
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
- Equivalent to ST_ENVELOPE(ST_UNION_AGG(geo)) but potentially more efficient
- GEOMETRY only: GEOGRAPHY has no spherical form here; convert with ST_TOGEOMETRY for a planar answer
- Not supported on BigQuery
- NULL inputs are ignored
- Returns NULL if all inputs are NULL
Availability
| Status | Backends |
|---|---|
| Available | duckdb, postgres, trino, databricks, serving |
Examples
FeatureQL
-- Bounding box over two points (ZIP + TRANSFORM)
RETURN
f1 := ZIP(ARRAY(ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(3.0, 4.0)) AS geom).TRANSFORM(
RETURN ST_ASTEXT(ST_EXTENT(geom))
).UNWRAP_ONE()
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 3 0, 3 4, 0 4, 0 0)) |
On this page