Share via


st_flipcoordinates

Important

This feature is in Public Preview.

Swaps the X and Y coordinates of the input geometry.

For the corresponding Databricks SQL function, see st_flipcoordinates function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.st_flipcoordinates(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str A Geometry value.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(1 2,3 4,5 6,7 8)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_flipcoordinates(dbf.st_geomfromtext('wkt', 4326))).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING(2 1,4 3,6 5,8 7)')]