Skip to main content

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

col1

pyspark.sql.Column or str

The longitude (in degrees) of the point we want represent with the returned H3 cell ID.

col2

pyspark.sql.Column or str

The latitude (in degrees) of the point we want represent with the returned H3 cell ID.

col3

pyspark.sql.Column, str, or int

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)]