Name

ST_ZMax — Returns the Z maxima of a 2D or 3D bounding box or a geometry.

Synopsis

float ST_ZMax(box3d aGeomorBox2DorBox3D);

Description

Returns the Z maxima of a 2D or 3D bounding box or a geometry.

[Note]

Although this function is only defined for box3d, it also works for box2d and geometry values due to automatic casting. However it will not accept a geometry or box2d text representation, since those do not auto-cast.

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves.

Examples

Code
SELECT ST_ZMax('BOX3D(1 2 3,4 5 6)');
Output
6
Code
SELECT ST_ZMax('LINESTRING(1 3 4,5 6 7)'::geometry);
Output
7
Figure
Geometry figure for visual-st-zmax-02
Code
SELECT ST_ZMax('BOX3D(-3 2 1,3 4 1)');
Output
1

Observe THIS DOES NOT WORK because it will try to auto-cast the string representation to a BOX3D.

Code
SELECT ST_ZMax('LINESTRING(1 3 4,5 6 7)');
Output
ERROR: BOX3D parser - doesn't start with BOX3D(
Code
SELECT ST_ZMax('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3)'::geometry);
Output
3
Figure
Geometry figure for visual-st-zmax-05