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:
- Equivalent to ST_ENVELOPE(ST_UNION_AGG(geo)) but potentially more efficient
- GEOMETRY only; for GEOGRAPHY use ST_CONVEXHULL(ST_UNION_AGG(geo)) instead
- Not supported on BigQuery
- NULL inputs are ignored
- Returns NULL if all inputs are NULL
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[ST_GEOMPOINT(0.0, 0.0), ST_GEOMPOINT(3.0, 4.0)] AS geom).TRANSFORM(SELECT ST_ASTEXT(ST_EXTENT(geom))).UNWRAP_ONE() -- Bounding box over two points (ZIP + TRANSFORM)
;Result
| f1 VARCHAR |
|---|
| POLYGON ((0 0, 3 0, 3 4, 0 4, 0 0)) |
On this page