Skip to content
πŸŽ‰ SedonaDB 0.4.0 is out now! πŸ—ΊοΈ Python DataFrame API, R dplyr, Geography support & GPU-accelerated spatial joins. Read the release blog β†’

ST_Box3D

Introduction: Return 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 serialises 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

Format: ST_Box3D(geom: Geometry)

Return type: Box3D

Since: v1.9.1

SQL Example

SELECT ST_AsText(ST_Box3D(ST_GeomFromWKT('LINESTRING Z(0 0 -3, 5 10 7)')))

Output:

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)')))

Output:

BOX3D(0.0 0.0 0.0, 5.0 10.0 0.0)

ST_Box3D is also produced by the SQL cast CAST(geom AS box3d) β€” see Type conversion.

Returns NULL for NULL or empty geometry input.