- Categories:
H3_POINT_TO_CELL¶
Returns the INTEGER value of an H3 cell ID for a Point (specified by a GEOGRAPHY object) at a given resolution.
- See also:
Syntax¶
H3_POINT_TO_CELL( <geography_point> , <target_resolution> )
Arguments¶
geography_point
A GEOGRAPHY object that represents a Point.
target_resolution
An INTEGER between 0 and 15 (inclusive) that specifies the H3 resolution (https://h3geo.org/docs/core-library/restable) that you want to use for the returned H3 cell.
Specifying any other INTEGER value results in an error.
Returns¶
Returns an INTEGER value that corresponds to the H3 cell ID for the given location and resolution.
Examples¶
The following example returns the H3 cell ID for the Brandenburg Gate at resolution 8.
SELECT H3_POINT_TO_CELL(ST_POINT(13.377704, 52.516262), 8);
+-----------------------------------------------------+
| H3_POINT_TO_CELL(ST_POINT(13.377704, 52.516262), 8) |
|-----------------------------------------------------|
| 613036919424548863 |
+-----------------------------------------------------+
The following example demonstrates that you cannot specify a resolution outside of 0 through 15.
SELECT H3_POINT_TO_CELL(ST_POINT(13.377704, 52.516262), 18);
100410 (P0000): Invalid H3 resolution value: 18. Resolution must be between 0 (coarsest) and 15 (finest).