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.
Parses the GeoJSON description and returns the corresponding Geography value.
For the corresponding Databricks SQL function, see st_geogfromgeojson function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_geogfromgeojson(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
A string value in GeoJSON format, representing a Geography value. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('{"type":"Polygon","coordinates":[[[0,0],[5,6],[7,-8],[0,0]]]}',)], ['geojson'])
df.select(dbf.st_asewkt(dbf.st_geogfromgeojson('geojson')).alias('result')).collect()
[Row(result='SRID=4326;POLYGON((0 0,5 6,7 -8,0 0))')]