ST_GridRing

更新时间: 2026-03-28 16:45:55

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.

上一篇: ST_GridDisk 下一篇: Indexes and operators
阿里云首页 云原生数据库 PolarDB 相关技术圈