| a5_compaction | R Documentation |
a5_compact() stores a set of cells as an a5_covering: every complete
group of siblings is replaced by its parent, repeatedly, giving the fewest
cells for the same set, and the covering records the resolution the set
stands for. a5_uncompact() expands coverings back to their cells at that
resolution, or at a finer one. Uncompacting a compacted set returns the
original cells, sorted in curve order and without duplicates.
a5_compact(cell, resolution = NULL)
a5_uncompact(x, resolution = NULL, simplify = TRUE)
cell |
An a5_cell vector. |
resolution |
Integer scalar resolution. For |
x |
An a5_covering vector, or an a5_cell vector treated as one
covering (see |
simplify |
Logical scalar. If |
Both work on the index hierarchy (see a5_hierarchy), so the coverage they preserve is the set of index descendants, not a geometric area.
a5_compact(): an a5_covering of length one.
a5_uncompact(): an a5_cell vector, or an a5_cell_list when
simplify = FALSE, with each covering's cells in curve order. A missing
covering contributes no cells (an empty element in the list form).
A covering can stand for far more cells than it stores: a country at
resolution 18 is about a billion cells, stored as a few hundred thousand.
a5_uncompact() refuses to build more than .Machine$integer.max cells;
check with a5_covering printing first, and prefer the covering functions
that work on compacted sets.
a5_covering, a5_polygon_to_cells() and a5_grid_disk(),
which return coverings.
cell <- a5_lonlat_to_cell(-3.19, 55.95, resolution = 5)
children <- a5_cell_to_children(cell, child_resolution = 7)
covering <- a5_compact(children) # stored as the parent
covering
a5_uncompact(covering) # the 16 children again
# expand to a finer resolution
a5_uncompact(a5_compact(cell), resolution = 7)
# one covering per element, kept apart with simplify = FALSE
disks <- a5_grid_disk(a5_cell_to_children(cell), k = 1)
a5_uncompact(disks, simplify = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.