st_geomfromewkt
Preview
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
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_geomfromewkt(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| 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
Python
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()
Output
[Row(result=0)]
Python
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()
Output
[Row(result='SRID=3857;POINT Z (1 2 3)')]