Share via


st_geomfromewkt

Important

This feature is in Public Preview.

Parses an Extended Well-Known Text (EWKT) description of a geometry and returns the corresponding Geometry value. The returned SRID is the SRID in the EWKT if specified, or 0 otherwise.

For the corresponding Databricks SQL function, see st_geomfromewkt function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.st_geomfromewkt(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str A string value, representing a geometry in Extended WKT (EWKT) format.

Notes

The SRID is the SRID in the EWKT if specified, or 0 otherwise.

The function returns None if the input is None.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT Z (1 2 3)',)], ['ewkt'])
df.select(dbf.st_srid(dbf.st_geomfromewkt('ewkt')).alias('result')).collect()
[Row(result=0)]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('SRID=3857;POINT Z (1 2 3)',)], ['ewkt'])
df.select(dbf.st_asewkt(dbf.st_geomfromewkt('ewkt')).alias('result')).collect()
[Row(result='SRID=3857;POINT Z (1 2 3)')]