跳转至
Apache Sedona 1.9.0 已正式发布,新增 Spark 4.1 支持、proj4sedona 坐标系转换、Bing Tile 函数等众多特性!

ST_3DExtent

Introduction: Return the 3D bounding box of all geometries in A as a typed Box3D. Empty geometries and null values are skipped. If all inputs are empty or null, the result is null. Geometries without a Z dimension fold into z = 0. Mirrors PostGIS ST_3DExtent.

ST_3DExtent is the 3D counterpart to ST_Extent, which returns a Box2D.

ST_3DExtent aggregates a column of geometries into the enclosing cuboid

Format: ST_3DExtent(A: geometryColumn)

Return type: Box3D

Since: v1.9.1

SQL Example

SELECT ST_AsText(ST_3DExtent(geom))
FROM VALUES
    (ST_GeomFromText('POINT Z (1 2 3)')),
    (ST_GeomFromText('POINT Z (4 5 -1)')),
    (ST_GeomFromText('LINESTRING (-3 0, 0 0)')) AS t(geom)

Output:

BOX3D(-3.0 0.0 -1.0, 4.0 5.0 3.0)

The XY-only linestring contributes z = 0, which sits between the -1 and 3 of the two POINT Z rows, so it does not move either Z bound.