Skip to content

H3_GRID_DISK

Returns a list of H3 cells that are within the supplied distance from the specified cell, inclusive.

Syntax

sql
H3_GRID_DISK(<cell>, <k>)

Arguments

  • <cell>: A BIGINT representing the H3 cell ID.
  • <k>: A non-negative BIGINT that represents the grid distance from the specified cell.

Returns

Returns a single-column table with the schema:

sql
h3_grid_disk BIGINT

Each row represents a cell within the grid distance k from the specified cell.

Providing an invalid cell or a negative k value results in an error.

Note

The function requires the configuration parameter enable_full_funcscan to be set to true.

Example

sql
SELECT h3_cell_to_hexstring(h3_grid_disk) FROM h3_grid_disk(h3_point_to_cell('POINT(0 0)'::geography, 3), 1);
-- 83754efffffffff
-- 837543fffffffff
-- 83755dfffffffff
-- 83754afffffffff
-- 837548fffffffff
-- 83754cfffffffff
-- 837541fffffffff