All Products
Search
Document Center

PolarDB:ST_GridRing

Last Updated:Mar 28, 2026

Returns the hollow ring of H3 grids at exactly grid distance k from the origin grid. Unlike ST_GridDisk, which returns all grids within distance k, ST_GridRing returns only the grids on the outermost ring at that exact distance.

Syntax

SETOF h3grid ST_GridRing(h3grid origin, integer k)

Parameters

ParameterTypeDescription
originh3gridThe central H3 grid.
kintegerThe grid distance from the origin.

Examples

The following example returns all H3 grids at grid distance 5 from the grid at latitude 25.1, longitude 123.1.

SELECT ST_GridRing(st_h3fromlatlng(25.1, 123.1), 5);

Output:

 st_griddisk
------------------------
 01010060170363C5BAF408
 01010066170363C5BAF408
 01010062170363C5BAF408
 01010063170363C5BAF408
 01010061170363C5BAF408
 ....
(31 rows)

What's next

  • ST_GridDisk: Returns all H3 grids within grid distance k from the origin (filled disk, not hollow ring).

  • st_h3fromlatlng: Converts a latitude/longitude coordinate to an H3 grid value.