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 a central H3 grid.

Syntax

setof h3grid ST_GridRing(h3grid origin, integer k)

Parameters

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

Example

Get all H3 grids at distance 5 from the grid at coordinates (25.1, 123.1):

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

Output:

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