Skip to main content

st_z

Preview

This feature is in Public Preview.

Returns the Z coordinate of the input point geometry, or None if the input point geometry is empty or if it does not have a Z coordinate.

For the corresponding Databricks SQL function, see st_z function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_z(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

A Geometry value.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT Z (1 2 3)',)], ['wkt'])
df.select(dbf.st_z(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=3.0)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT ZM (1 2 3 4)',)], ['wkt'])
df.select(dbf.st_z(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=3.0)]