Skip to main content

st_rotate

Preview

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

Python
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

Python
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()
Output
[Row(result='SRID=4326;POINT ZM (2 3 40 27)')]