Builds a new geoframe that keeps focus atoms at full resolution and
collapses everything else into progressively coarser rings drawn from
levels. The result is a partition of the atoms, carried as a geoframe.
Arguments
- x
A
Geoscale.- focus
Character vector of atom codes to keep at full resolution.
- levels
Ordered geoframes to build rings from, coarsest first. Defaults to every geoframe of
xexcept the atom layer.- name
Name of the new geoframe. Default
"zoom".- label_rest
sprintfformat for a ring's code, with%sthe parent code. Default"%s_rest".
Value
A Geoscale with geoframes levels[1], name and the atom layer;
weights and geometry carried through unchanged.
Details
With focus atoms and levels = c("nuts0", "nuts1", "nuts2") (coarsest
first), each remaining atom joins the finest ring that also contains a
focus atom, so the cut telescopes outward:
the focus atoms themselves, individually;
the rest of each
nuts2holding a focus atom;the rest of each
nuts1holding one of those;the rest of each
nuts0holding one of those;every other atom, grouped at
levels[1].
The intermediate geoframes are dropped. A ring like "rest of nuts1" spans
several nuts2, so the cut cannot nest with the levels it was carved from;
only levels[1] and the atom layer are kept beside it. That is checked, not
assumed — see geoscale_nests().
See also
filter_geoscale() to sample, prune_geoscale() to coarsen
uniformly, geoscale_nests() for the guarantee this relies on.
Examples
gs <- geoscale_example()
z <- zoom_geoscale(gs, focus = "A1", levels = c("country", "state"))
geoscale_geoframes(z)
#> [1] "country" "zoom" "atom"
geoscale_regions(z, "zoom")
#> [1] "A1" "N1_rest" "N_rest" "S"
