st_x
Preview
This feature is in Public Preview.
Returns the X coordinate of the input point geometry, or None if the input point geometry is empty.
For the corresponding Databricks SQL function, see st_x function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_x(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A Geometry value. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT(1 2)',)], ['wkt'])
df.select(dbf.st_x(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=1.0)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT ZM (1 2 3 4)',)], ['wkt'])
df.select(dbf.st_x(dbf.st_geomfromtext('wkt')).alias('result')).collect()
Output
[Row(result=1.0)]