snowflake.snowpark.functions.h3_latlng_to_cell

snowflake.snowpark.functions.h3_latlng_to_cell(latitude: Union[snowflake.snowpark.column.Column, str], longitude: Union[snowflake.snowpark.column.Column, str], target_resolution: Union[snowflake.snowpark.column.Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.40.0/src/snowflake/snowpark/_functions/scalar_functions.py#L1863-L1890)

Returns the H3 cell ID for the given latitude, longitude, and resolution.

Parameters:
  • latitude (ColumnOrName) – The latitude values.

  • longitude (ColumnOrName) – The longitude values.

  • target_resolution (ColumnOrName) – The target H3 resolution.

Returns:

H3 cell ID for the given latitude, longitude, and resolution.

Return type:

Column

Example:

>>> df = session.create_dataframe([[52.516262, 13.377704, 8]], schema=["lat", "lng", "res"])
>>> df.select(h3_latlng_to_cell(df["lat"], df["lng"], df["res"])).collect()
[Row(H3_LATLNG_TO_CELL("LAT", "LNG", "RES")=613036919424548863)]
Copy
Language: English