h3_longlatash3
Returns the H3 cell ID (as a int) corresponding to the provided longitude and latitude at the specified resolution. Supports Spark Connect.
For the corresponding Databricks SQL function, see h3_longlatash3 function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.h3_longlatash3(col1=<col1>, col2=<col2>, col3=<col3>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The longitude (in degrees) of the point we want represent with the returned H3 cell ID. |
|
| The latitude (in degrees) of the point we want represent with the returned H3 cell ID. |
|
| The resolution of the H3 cell IDs to return. Must be between 0 and 15, inclusive. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(100, 45, 6,)], ['lon', 'lat', 'res'])
df.select(dbf.h3_longlatash3('lon', 'lat', 'res').alias('result')).collect()
Output
[Row(result=604116085645508607)]
Python
df.select(dbf.h3_longlatash3('lon', 'lat', 6).alias('result')).collect()
Output
[Row(result=604116085645508607)]