Skip to main content
Returns the planar 3D bounding box of a geometry as a typed Box3D value (six doubles: xmin, ymin, zmin, xmax, ymax, zmax). Geometries without a Z dimension fold into zmin = zmax = 0, matching PostGIS. ST_Box3D is the 3D counterpart to ST_Box2D; it always returns a Box3D value that serializes to a struct of six non-nullable doubles and round-trips through Parquet without WKB overhead. ST_Box3D returns the tightest cuboid enclosing a geometry It is also produced by the SQL cast CAST(geom AS box3d). Returns NULL for NULL or empty geometry input.

Signatures

ST_Box3D(geom: Geometry)

Parameters

geom
Geometry
required
The geometry whose 3D bounding box is returned.

Return type

The 3D bounding box as a Box3D value.

Example

SELECT ST_AsText(ST_Box3D(ST_GeomFromWKT('LINESTRING Z(0 0 -3, 5 10 7)')))
BOX3D(0.0 0.0 -3.0, 5.0 10.0 7.0)
A 2D geometry folds its Z extent to 0:
SELECT ST_AsText(ST_Box3D(ST_GeomFromWKT('LINESTRING (0 0, 5 10)')))
BOX3D(0.0 0.0 0.0, 5.0 10.0 0.0)