All Products
Search
Document Center

ApsaraDB RDS:ST_GridPath

Last Updated:Mar 28, 2026

Returns the sequence of H3 grid cells forming a path between two cells.

Syntax

SETOF h3grid ST_GridPath(h3grid start, h3grid end);

Parameters

ParameterTypeDescription
starth3gridThe starting H3 grid cell.
endh3gridThe destination H3 grid cell.

Example

Find all H3 grid cells on the path between two points 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)

See also

  • ST_GridDistance: Get the number of grid steps between two H3 cells.

  • ST_H3FromLatLng: Convert a latitude/longitude coordinate to an H3 cell at a given resolution.