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.
Returns an array of H3 cell IDs that form a hollow hexagonal ring centered at the origin H3 cell and that are at grid distance k from the origin H3 cell. Supports Spark Connect.
For the corresponding Databricks SQL function, see h3_hexring function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.h3_hexring(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
An H3 cell ID, represented as a Column or string. |
col2 |
pyspark.sql.Column, str, or int |
The grid distance from the H3 cell ID (first argument). |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686042433355775, 1,),], ['h3l', 'k'])
df.select(dbf.h3_hexring('h3l', 'k').alias('result')).collect()
[Row(result=[599686014516068351, 599686030622195711, 599686044580839423, 599686038138388479, 599686043507097599, 599686015589810175])]
df.select(dbf.h3_hexring('h3l', 1).alias('result')).collect()
[Row(result=[599686014516068351, 599686030622195711, 599686044580839423, 599686038138388479, 599686043507097599, 599686015589810175])]