snowflake.snowpark.functions.h3_try_coverage_strings¶
- snowflake.snowpark.functions.h3_try_coverage_strings(geography_expression: 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#L2013-L2041)¶
Returns an array of H3 cell IDs as strings that cover the given geography at the specified resolution. This function attempts to provide coverage of the geography using H3 cells, returning the cell IDs as strings.
- Parameters:
geography_expression (ColumnOrName) – A geography expression to be covered by H3 cells
target_resolution (ColumnOrName) – The H3 resolution level for the coverage, ranging from 0 to 15
- Returns:
An array of H3 cell ID strings that cover the input geography
- Return type:
Examples:
>>> from snowflake.snowpark.functions import to_geography >>> 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=["geog"]) >>> df.select(h3_try_coverage_strings(to_geography(df["geog"]), lit(9)).alias("coverage")).collect() [Row(COVERAGE='[\n "89283082803ffff",\n "8928308280bffff",\n "8928308280fffff",\n "89283082843ffff",\n "89283082847ffff",\n "8928308284fffff",\n "89283082857ffff",\n "89283082863ffff",\n "89283082867ffff",\n "8928308286bffff",\n "8928308286fffff",\n "89283082873ffff",\n "89283082877ffff",\n "8928308287bffff",\n "89283082aa7ffff",\n "89283082ab7ffff",\n "89283082b9bffff"\n]')]