Appearance
H3_GRID_PATH
Returns a list of H3 cells that represent the line between two cells. Note that this path follows a straight line on the H3 grid, which is not necessarily the shortest path over the surface of the Earth (a geodesic).
Syntax
sql
H3_GRID_PATH(<cell1>, <cell2>)Arguments
<cell1>: ABIGINTrepresenting an H3 cell ID.<cell2>: ABIGINTrepresenting an H3 cell ID.
Returns
Returns a single-column table with the schema:
sql
h3_grid_path BIGINTEach row represents a cell making up the line between the two passed in cells.
The two input cells must be the same resolution otherwise an error is returned.
Note
The function requires the configuration parameter enable_full_funcscan to be set to true.
Example
sql
SELECT h3_cell_to_hexstring(h3_grid_path) FROM h3_grid_path(h3_point_to_cell('POINT(0 0)'::geography, 3), h3_point_to_cell('POINT(10 0)'::geography, 3));
-- h3_cell_to_hexstring
-- ----------------------
-- 83754efffffffff
-- 83754cfffffffff
-- 83756bfffffffff
-- 837569fffffffff
-- 8382e9fffffffff
-- 8382e8fffffffff
-- 8382eefffffffff
-- 8382e3fffffffff
-- 8382e2fffffffff
-- 8382f5fffffffff
-- 8382f4fffffffff