a5_grid_disk: Cells within k hops of a cell

View source: R/traversal.R

a5_grid_diskR Documentation

Cells within k hops of a cell

Description

Returns, for each centre cell, the cells reachable within k hops, including the centre cell itself, as an a5_covering. a5_grid_disk() steps between cells that share an edge; a5_grid_disk_vertex() also steps between cells that share only a vertex, so it reaches more cells for the same k.

Usage

a5_grid_disk(cell, k)

a5_grid_disk_vertex(cell, k)

Arguments

cell

An a5_cell vector of centre cells.

k

Non-negative integer scalar, number of hops.

Value

An a5_covering vector the same length as cell, at the resolution of each centre cell. NA where cell is NA. Use a5_uncompact() for the cells.

See Also

a5_spherical_cap() for distance-based selection.

Examples

cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 8)
disk <- a5_grid_disk(cell, k = 1)
disk
a5_uncompact(disk)
a5_grid_disk_vertex(cell, k = 1)

cells <- a5_lonlat_to_cell(c(-3.19, 0), c(55.95, 0), resolution = 5)
a5_grid_disk(cells, k = 2) # one covering per cell

a5R documentation built on Oct. 19, 2026, 5:08 p.m.