snowflake.snowpark.functions.h3_polygon_to_cells_strings¶

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

Returns an array of H3 cell IDs (as strings) that cover the given geography polygon at the specified resolution.

Parameters:
  • geography_polygon (ColumnOrName) – The GEOGRAPHY polygon to convert to H3 cells.

  • target_resolution (ColumnOrName) – The H3 resolution level (0-15) for the output cells.

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'])
>>> df.select(h3_polygon_to_cells_strings(to_geography(df['polygon_wkt']), lit(9))).collect()
[Row(H3_POLYGON_TO_CELLS_STRINGS(TO_GEOGRAPHY("POLYGON_WKT"), 9)='[\n  "892830870bbffff",\n  "89283087397ffff",\n  "89283087023ffff",\n  "89283087027ffff",\n  "8928308715bffff",\n  "8928308702fffff",\n  "89283087033ffff",\n  "892830870abffff",\n  "89283087037ffff"\n]')]
Copy