Pular para o conteúdo principal

st_z function

Applies to: check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

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

Syntax

st_z ( geoExpr )

Arguments

  • geoExpr: A GEOMETRY value.

Returns

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

The function returns NULL if the input is NULL or if the point is empty.

Examples

SQL
-- Returns the Z coordinate of a non-empty point geometry with a Z coordinate.
> SELECT st_z(st_geomfromtext('POINT Z (1 2 3)'));
3.0
-- Returns the Z coordinate of a non-empty point geometry without a Z coordinate.
> SELECT st_z(st_geomfromtext('POINT M (2 3 4)'));
NULL
-- Returns `NULL` for an empty point geometry.
> SELECT st_z(st_geomfromtext('POINT ZM EMPTY'));
NULL