snowflake.snowpark.functions.h3_try_polygon_to_cells_strings¶
- snowflake.snowpark.functions.h3_try_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. Returns NULL if the input is invalid.
- Parameters:
geography_polygon (ColumnOrName) – The GEOGRAPHY polygon.
target_resolution (ColumnOrName) – The target H3 resolution (0-15).
- Returns:
An array of H3 cell IDs as strings, or NULL if the input is invalid.
- Return type:
- Example::
>>> from snowflake.snowpark.functions import to_geography, lit
>>> df = session.create_dataframe([ ... ['POLYGON((-122.4194 37.7749, -122.4094 37.7749, -122.4094 37.7849, -122.4194 37.7849, -122.4194 37.7749))'] ... ], schema=["polygon_wkt"])
>>> df.select(h3_try_polygon_to_cells_strings(to_geography(df["polygon_wkt"]), lit(9))).collect() [Row(H3_TRY_POLYGON_TO_CELLS_STRINGS(TO_GEOGRAPHY("POLYGON_WKT"), 9)='[\n "8928308287bffff",\n "8928308280fffff",\n "89283082873ffff",\n "8928308286bffff",\n "89283082847ffff",\n "89283082863ffff",\n "89283082877ffff",\n "8928308280bffff",\n "89283082867ffff"\n]')]