h3_centerasgeojson
Returns the center of an H3 cell in GeoJSON format. Supports Spark Connect.
For the corresponding Databricks SQL function, see h3_centerasgeojson function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.h3_centerasgeojson(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| An H3 cell ID, represented as a Column or string. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686042433355775,),], ['h3l'])
df.select(dbf.h3_centerasgeojson('h3l').alias('result')).collect()
Output
[Row(result='{"type":"Point","coordinates":[-121.976375973,37.345793375]}')]