Traversal functions in the A5 Geospatial Index DuckDB extension
Function category
Traversal
3 functionsFind cells in a neighborhood: edge- or vertex-adjacent grid disks for fixed-step traversal, or all cells within a metric radius. Use these for proximity queries and spatial joins.
Signature
a5_grid_disk(cell: UBIGINT, k: INTEGER) → UBIGINT[]
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Argument
k
|
Type
INTEGER
|
Mode Positional | Description |
Description
Returns all A5 cells within k edge-steps of the given cell (edge adjacency)
1
Example 1
SELECT a5_grid_disk(a5_lonlat_to_cell(-122.4, 37.8, 10), 1);
Output
| a5_grid_disk(a5_lonlat_to_cell(-122.4, 37.8, 10), 1) |
|---|
| [1936189948734472192, 1936191048246099968, 1937277365734342656, 1937278465245970432, 1937279564757598208, 1937281763780853760] |
Signature
a5_grid_disk_vertex(cell: UBIGINT, k: INTEGER) → UBIGINT[]
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Argument
k
|
Type
INTEGER
|
Mode Positional | Description |
Description
Returns all A5 cells within k vertex-steps of the given cell (vertex adjacency)
1
Example 1
SELECT a5_grid_disk_vertex(a5_lonlat_to_cell(-122.4, 37.8, 10), 1);
Output
| a5_grid_disk_vertex(a5_lonlat_to_cell(-122.4, 37.8, 10), 1) |
|---|
| [1936188849222844416, 1936189948734472192, 1936191048246099968, 1936192147757727744, 1937277365734342656, 1937278465245970432, 1937279564757598208, 1937281763780853760] |
Signature
a5_spherical_cap(cell: UBIGINT, radius: DOUBLE) → UBIGINT[]
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
cell
|
Type
UBIGINT
|
Mode Positional | Description |
Argument
radius
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns all A5 cells within the specified radius (in meters) of the given cell
1
Example 1
SELECT a5_spherical_cap(a5_lonlat_to_cell(-122.4, 37.8, 10), 1000.0);
Output
| a5_spherical_cap(a5_lonlat_to_cell(-122.4, 37.8, 10), 1000.0) |
|---|
| [1937278465245970432] |