Skip to main content
Returns 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 serializes to a struct of four non-nullable doubles and round-trips through Parquet without WKB overhead. It is also produced by the SQL cast CAST(geom AS box2d). Returns NULL for NULL or empty geometry input.

Signatures

ST_Box2D(geom: Geometry)

Parameters

geom
Geometry
required
The geometry whose planar bounding box is returned.

Return type

The planar bounding box as a Box2D value.

Example

SELECT ST_AsText(ST_Box2D(ST_GeomFromWKT('LINESTRING (0 0, 10 20)')))
BOX(0.0 0.0, 10.0 20.0)