snowflake.snowpark.functions.h3_coverage_strings¶

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

Returns an array of H3 cell identifiers as strings that cover the given geography at the specified resolution.

Parameters:
  • geography_expression (ColumnOrName) – The GEOGRAPHY to cover.

  • target_resolution (ColumnOrName, int) – The H3 resolution level (0-15).

Returns:

An array of H3 cell identifiers as strings.

Return type:

Column

Example:

>>> from snowflake.snowpark.functions import to_geography
>>> 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=["geo_wkt"])
>>> df.select(h3_coverage_strings(to_geography(df["geo_wkt"]), 8).alias("h3_cells")).collect()
[Row(H3_CELLS='[\n  "8828308701fffff",\n  "8828308703fffff",\n  "8828308709fffff",\n  "882830870bfffff",\n  "8828308715fffff",\n  "8828308739fffff"\n]')]
Copy