st_transform
Preview
This feature is in Public Preview.
Transforms the X and Y coordinates of the input geometry to the coordinate reference system (CRS) described by the provided SRID value. Z and M coordinates are not transformed.
For the corresponding Databricks SQL function, see st_transform function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_transform(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A Geometry value. |
|
| The SRID value of the new coordinate reference system (CRS) to which the input geometry should be transformed. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOINT Z (4 5 14,-3 8 27,EMPTY)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_transform(dbf.st_geomfromtext('wkt', 4326), 3857)).alias('result')).collect()
Output
[Row(result='SRID=3857;MULTIPOINT Z ((445277.96317309426 557305.2572745768 14),(-333958.4723798207 893463.751012646 27),EMPTY)')]