Returns the filled-in disk of H3 cells within at most k grid steps of the origin cell. Output order is not guaranteed.
Syntax
setof h3grid ST_GridDisk(h3grid origin, integer k);Parameters
| Parameter | Type | Description |
|---|---|---|
origin | h3grid | The central H3 cell. |
k | integer | The maximum grid distance from the origin. 0 returns only the origin cell; 1 returns the origin and its six immediate neighbors (7 cells total). |
Returns
A set of h3grid values representing all H3 cells within grid distance k of the origin, inclusive. For a typical hexagonal cell, the result count follows 3k² + 3k + 1 — for example, k=5 returns 91 cells.
Output order is not guaranteed. Do not rely on the row order of the result set.
Examples
The following example returns all H3 cells within grid distance 5 of a cell at latitude 25.1, longitude 123.1.
SELECT ST_GridDisk(st_h3fromlatlng(25.1, 123.1), 5); st_griddisk
------------------------
01010060170363C5BAF408
01010066170363C5BAF408
01010062170363C5BAF408
01010063170363C5BAF408
01010061170363C5BAF408
....
(91 rows)