Share via


h3_longlatash3string

Returns the H3 cell ID (as a string) corresponding to the provided longitude and latitude at the specified resolution. Supports Spark Connect.

For the corresponding Databricks SQL function, see h3_longlatash3string function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.h3_longlatash3string(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

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(100, 45, 6,)], ['lon', 'lat', 'res'])
df.select(dbf.h3_longlatash3string('lon', 'lat', 'res').alias('result')).collect()
[Row(result='86240610fffffff')]