H3_TRY_GRID_DISTANCE
functionsupportedCore SQL functionsA special version of H3_GRID_DISTANCE that returns NULL if an error occurs when it attempts to return the distance between two H3 cells.
Syntax
H3_TRY_GRID_DISTANCE( <cell_id_1> , <cell_id_2> )
Parameters
| Name | Required | Description |
|---|---|---|
cell_id_1 | required | An INTEGER value that represents the H3 cell ID (index), or a VARCHAR value that represents the cell ID in hexadecimal format. |
cell_id_2 | required | An INTEGER value that represents the H3 cell ID (index), or a VARCHAR value that represents the cell ID in hexadecimal format. |
Returns
Returns an INTEGER value or NULL. - If the function can perform a successful calculation, returns the INTEGER value that represents the distance in grid cells between the two H3 cells. - If the grid distance cannot be calculated (for example, when two cells belong to non-neighboring base cells), returns NULL without reporting an error.
Usage notes
- See H3_GRID_DISTANCE for the usage notes.