Share via


st_zmax function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Returns the maximum Z coordinate of the input GEOMETRY, or NULL if the geometry is empty or does not have a Z coordinate.

Syntax

st_zmax ( geoExpr )

Arguments

  • geoExpr: A GEOMETRY value.

Returns

A value of type DOUBLE, maximum Z coordinate of the input GEOMETRY.

The function returns NULL if the input is NULL or if the geometry is empty or does not have a Z coordinate.

Examples

-- Returns the maximum Z coordinate of a non-empty geometry with a Z coordinate.
> SELECT st_zmax(st_geomfromtext('LINESTRING Z (10 34 -1,44 57 -2,30 24 -5)'))
  -1.0
-- Returns `NULL` for a non-empty geometry without a Z coordinate.
> SELECT st_zmax(st_geomfromtext('LINESTRING(10 34,44 57,30 24)'))
  NULL