H3_COVERAGE
functionsupportedCore SQL functionsReturns an array of IDs (as INTEGER values) identifying the minimal set of H3 cells that completely cover a shape (specified by a GEOGRAPHY object).
Syntax
H3_COVERAGE( <geography_expression> , <target_resolution> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression | required | A GEOGRAPHY object. |
target_resolution | required | An INTEGER between 0 and 15 (inclusive) specifying the H3 resolution that you want to use for the returned H3 cells. Specifying any other INTEGER value results in an error. |
Returns
Returns an ARRAY of INTEGER values for the IDs of the minimal set of H3 cells that have completely cover the specified input shape.
Usage notes
- The function uses spherical approximation, which treats points on the Earth’s surface as if they were connected by arcs, rather than straight lines. If you need a planar approximation, use H3_POLYGON_TO_CELLS instead.
- A cell is included in the result set if its boundary intersects the input shape.
- When you apply FLATTEN to the ARRAY returned by the function, cast each value explicitly to an integer.
- If it isn’t possible to compute the coverage for an invalid GEOGRAPHY object, the function returns NULL. For more information, see Effects on GEOGRAPHY objects.
- If the number of H3 cells that cover the input shape exceeds the allowed limit, the function reports an error. To return NULL instead of reporting an error, use H3_TRY_COVERAGE.