Returns all cells at the target resolution that intersect the given geometry. Uses hierarchical flood-fill: starting from the 12 resolution-0 root cells, the algorithm repeatedly expands and prunes by spatial intersection until the target resolution is reached.
Arguments
- x
An area specification. One of:
A numeric vector of length 4 (
c(xmin, ymin, xmax, ymax)) interpreted as a WGS 84 bounding box.Any geometry handleable by
wk::wk_handle()(e.g.wk::wkt(),wk::wkb(),sfc,sf, a5_cell).
- resolution
Integer scalar target resolution (0–30).
Value
An a5_cell vector of cells at resolution that intersect x.
Details
Grid generation runs entirely in Rust via hierarchical flood-fill with bounding-box pruning. For non-bbox geometry inputs, an exact intersection filter removes cells that fall outside the target shape. No cell count limit is imposed — high resolutions over large areas can consume significant memory.
Input geometries must use WGS 84 coordinates; projected geometries are
not reprojected and will produce incorrect results. Multiple geometries
are collected into a GEOMETRYCOLLECTION automatically.
Antimeridian-crossing bounding boxes are supported: when xmin > xmax
(e.g. c(170, -50, -170, -30)), the bbox is split at the antimeridian.
Limitation: spatial filtering uses planar geometry on lon/lat coordinates, which can produce incomplete results very close to the poles (above ~88° latitude) or the antimeridian. Use a larger target geometry to ensure complete coverage in these areas.
See also
a5_cell_to_boundary() to convert result cells to geometries.