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_Box2D

Introduction: Return the planar bounding box of a Geometry as a typed Box2D value (four doubles: xmin, ymin, xmax, ymax).

ST_Box2D is the typed counterpart to ST_Envelope. ST_Envelope returns the envelope as a Geometry — typically a polygon, but JTS may return a Point or LineString for degenerate inputs. ST_Box2D always returns a Box2D value that serialises to a struct of four non-nullable doubles and round-trips through Parquet without WKB overhead.

Format: ST_Box2D(geom: Geometry)

Return type: Box2D

Since: v1.9.1

SQL Example

SELECT ST_AsText(ST_Box2D(ST_GeomFromWKT('LINESTRING (0 0, 10 20)')))

Output:

BOX(0.0 0.0, 10.0 20.0)

ST_Box2D is also produced by the SQL cast CAST(geom AS box2d) — see Type conversion.

Returns NULL for NULL or empty geometry input.