Skip to main content

Geospatial

The geospatial module of the SDK can help users do geospatial analysis in Databricks.

Registering Sedona module​

Registration is only required when using the Apache Sedona Python API (e.g. GeoDataFrame.pipe(spark.createDataFrame)). For more information on usage, you may refer to this page.

You can find more information of Sedona related functions here.

def register_sedona() -> None:
"""
Returns
-------
None
"""

Convert GeoJSON to Dataframe​

def read_geojson_raw(geojson_str, output_type="spark"):
"""
Function to transform raw geojson string into dataframe.
Geojson format: https://datatracker.ietf.org/doc/html/rfc7946#section-1.5

Parameters
----------
geojson_str : str
String representation of geojson
output_type : str, optional
`spark` or `geopandas` dataframe (default is spark)

Returns
-------
dataframe
Geojson in table format. `geometry` column in WKT format.
"""