snowflake.snowpark.functions.h3_coverage¶

snowflake.snowpark.functions.h3_coverage(geography_expression: Union[snowflake.snowpark.column.Column, str], target_resolution: Union[snowflake.snowpark.column.Column, str]) → Column[source]¶

Returns an array of H3 cell IDs that cover the given geography at the specified resolution.

Parameters:
  • geography_expression (ColumnOrName) – A GEOGRAPHY object.

  • target_resolution (ColumnOrName) – The target H3 resolution (0-15).

Returns:

An array of H3 cell IDs as strings.

Return type:

Column

Example::
>>> from snowflake.snowpark.functions import to_geography, lit
>>> df = session.create_dataframe([
...     ["POLYGON((-122.481889 37.826683,-122.479487 37.808548,-122.474150 37.808904,-122.476510 37.826935,-122.481889 37.826683))"]
... ], schema=["polygon_wkt"])
>>> result = df.select(h3_coverage(to_geography(df["polygon_wkt"]), lit(8)).alias("h3_cells")).collect()
>>> result
[Row(H3_CELLS='[\n  613196571539931135,\n  613196571542028287,\n  613196571548319743,\n  613196571550416895,\n  613196571560902655,\n  613196571598651391\n]')]
Copy