H3_POLYGON_TO_CELLS
functionsupportedCore SQL functionsReturns an array of INTEGER values of the IDs of H3 cells that have centroids contained by a Polygon (specified by a GEOGRAPHY object).
Syntax
H3_POLYGON_TO_CELLS( <geography_polygon> , <target_resolution> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_polygon | required | A GEOGRAPHY object that represents a Polygon. |
target_resolution | required | An INTEGER between 0 and 15 (inclusive) that specifies 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 H3 cells that have centroids contained in the specified input Polygon.
Usage notes
- The function uses planar approximation, which treats points on the Earth’s surface as if they were connected by straight lines, rather than curved arcs. If you need a spherical approximation, use H3_COVERAGE instead.
- A cell is considered to be within the Polygon if its centroid is contained by the Polygon.
- When you apply FLATTEN to the array returned by the function, cast each value explicitly to an integer.