Skip to content
Apache Sedona 1.9.0 is out now, featuring Spark 4.1 support, proj4sedona CRS transformation, Bing Tile functions, and more!

ST_Extent

Introduction: Return the planar bounding box of all geometries in A as a typed Box2D. Empty geometries and null values are skipped. If all inputs are empty or null, the result is null. Mirrors PostGIS ST_Extent.

ST_Extent is the typed counterpart to ST_Envelope_Agg. ST_Envelope_Agg returns the envelope as a Geometry; ST_Extent returns it as a Box2D value that serialises to a struct of four doubles.

Format: ST_Extent(A: geometryColumn)

Return type: Box2D

Since: v1.9.1

SQL Example

SELECT ST_AsText(ST_Extent(geom))
FROM VALUES
    (ST_GeomFromText('POINT (1 1)')),
    (ST_GeomFromText('POINT (5 7)')),
    (ST_GeomFromText('LINESTRING (3 2, 6 4)')) AS t(geom)

Output:

BOX(1.0 1.0, 6.0 7.0)