Returns a set of H3 grids that form the shortest contiguous path between two H3 grids, inclusive of both endpoint grids.
Syntax
setof h3grid ST_GridPath(h3grid start, h3grid end);Parameters
| Parameter | Description |
|---|---|
start | The starting H3 grid. |
end | The ending H3 grid. |
Example
The following example returns the H3 grids on the path between two coordinates at resolution 8.
SELECT ST_GridPath(ST_H3FromLatLng(25.1, 123.1, 8), ST_H3FromLatLng(25.2, 123.2, 8));Output:
st_gridpath
------------------------
010100FFFF1F63C5BA8408
010100FFFFBF63C5BA8408
010100FFFF7F61C5BA8408
010100FFFF3F61C5BA8408
010100FFFFDF6CC5BA8408
010100FFFF1F6CC5BA8408
010100FFFFBF6CC5BA8408
010100FFFF7F93C1BA8408
010100FFFF3F93C1BA8408
010100FFFFDF9EC1BA8408
010100FFFF9F9EC1BA8408
010100FFFF5F9CC1BA8408
010100FFFF1F9CC1BA8408
010100FFFF3F9CC1BA8408
010100FFFFDF9DC1BA8408
010100FFFF9F9DC1BA8408
010100FFFF5F8EC1BA8408
010100FFFF1F8EC1BA8408
(18 rows)