Skip to main content

st_geomfromgeojson

Preview

This feature is in Public Preview. You can confirm preview enrollment on the Previews page. See Manage Databricks previews.

Parses the GeoJSON description and returns the corresponding Geometry value.

For the corresponding Databricks SQL function, see st_geomfromgeojson function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_geomfromgeojson(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

A string value in GeoJSON format, representing a Geometry value.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('{"type":"LineString","coordinates":[[5,6],[7,-8]]}',)], ['geojson'])
df.select(dbf.st_asewkt(dbf.st_geomfromgeojson('geojson')).alias('result')).collect()
Output
[Row(result='SRID=4326;LINESTRING(5 6,7 -8)')]