Categories:

Geospatial functions

H3_CELL_TO_POINT¶

Returns the GEOGRAPHY object representing the Point that is the centroid of an H3 cell.

See also:

H3_POINT_TO_CELL , H3_POINT_TO_CELL_STRING

Syntax¶

H3_CELL_TO_POINT( <cell_id> )
Copy

Arguments¶

cell_id

An INTEGER that represents the H3 cell ID (index), or a VARCHAR that represents the cell ID in hexadecimal format.

Returns¶

Returns a GEOGRAPHY object for the Point that represents the centroid of the H3 cell with the specified ID.

Examples¶

The following example returns the GEOGRAPHY object for the Point that represents the centroid of the H3 cell containing the Brandenburg Gate. The example specifies the H3 cell ID as an INTEGER value.

SELECT H3_CELL_TO_POINT(613036919424548863);
Copy
+--------------------------------------+
| H3_CELL_TO_POINT(613036919424548863) |
|--------------------------------------|
| {                                    |
|   "coordinates": [                   |
|     1.337676791184706e+01,           |
|     5.251638386722465e+01            |
|   ],                                 |
|   "type": "Point"                    |
| }                                    |
+--------------------------------------+

The following example specifies the hexadecimal value of the H3 cell ID as a VARCHAR to return the same coordinates as the previous example.

SELECT H3_CELL_TO_POINT('881F1D4887FFFFF');
Copy
+-------------------------------------+
| H3_CELL_TO_POINT('881F1D4887FFFFF') |
|-------------------------------------|
| {                                   |
|   "coordinates": [                  |
|     1.337676791184706e+01,          |
|     5.251638386722465e+01           |
|   ],                                |
|   "type": "Point"                   |
| }                                   |
+-------------------------------------+