h3_boundaryasgeojson
Returns the boundary of an H3 cell in GeoJSON format. Supports Spark Connect.
For the corresponding Databricks SQL function, see h3_boundaryasgeojson function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.h3_boundaryasgeojson(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_boundaryasgeojson('h3l').alias('result')).collect()
Output
[Row(result='{"type":"Polygon","coordinates":[[[-121.915080327,37.271355867],[-121.862223289,37.353926451],[-121.923549996,37.428341186],[-122.037734964,37.420128678],[-122.090428929,37.337556084],[-122.029101309,37.263197975],[-121.915080327,37.271355867]]]}')]