Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is in Public Preview.
Rotates the input geometry around the Z axis by the given rotation angle (in radians).
For the corresponding Databricks SQL function, see st_rotate function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_rotate(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
A Geometry value. |
col2 |
pyspark.sql.Column or float |
A DOUBLE value representing the rotation angle (in radians). |
Examples
from pyspark.databricks.sql import functions as dbf
from math import pi
df = spark.createDataFrame([('POINT ZM (3 -2 40 27)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_rotate(dbf.st_geomfromtext('wkt', 4326), pi / 2)).alias('result')).collect()
[Row(result='SRID=4326;POINT ZM (2 3 40 27)')]