ST_GridPath returns the sequence of H3 grid cells that form a path between two cells.
Syntax
setof h3grid ST_GridPath(h3grid start, h3grid end);Parameters
| Parameter | Description |
|---|---|
start | The starting H3 grid object. |
end | The ending H3 grid object. |
Example
The following example finds the path between two resolution-8 H3 cells near (25.1°N, 123.1°E) and (25.2°N, 123.2°E).
SELECT ST_GridPath(st_h3fromlatlng(25.1,123.1,8),st_h3fromlatlng(25.2,123.2,8));Expected output (18 rows):
st_gridpath
------------------------
010100FFFF1F63C5BA8408
010100FFFFBF63C5BA8408
010100FFFF7F61C5BA8408
010100FFFF3F61C5BA8408
010100FFFFDF6CC5BA8408
010100FFFF1F6CC5BA8408
010100FFFFBF6CC5BA8408
010100FFFF7F93C1BA8408
010100FFFF3F93C1BA8408
010100FFFFDF9EC1BA8408
010100FFFF9F9EC1BA8408
010100FFFF5F9CC1BA8408
010100FFFF1F9CC1BA8408
010100FFFF3F9CC1BA8408
010100FFFFDF9DC1BA8408
010100FFFF9F9DC1BA8408
010100FFFF5F8EC1BA8408
010100FFFF1F8EC1BA8408
(18 rows)