Builds a new geoframe that keeps focus leaves at full resolution and
collapses everything else into progressively coarser rings drawn from
geoframes. The result is a partition of the leaves, carried as a geoframe.
Arguments
- x
A
GeoScale.- focus
Character vector of leaf codes to keep at full resolution.
- geoframes
Ordered geoframes to build rings from, coarsest first. Defaults to every geoframe of
xexcept the leaf 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 geoframes[1], name and the leaf
geoframe; weights and geometry carried through unchanged.
Details
With focus leaves and geoframes = c("nuts0", "nuts1", "nuts2") (coarsest
first), each remaining leaf joins the finest ring that also contains a
focus leaf, so the cut telescopes outward:
the focus leaves themselves, individually;
the rest of each
nuts2holding a focus leaf;the rest of each
nuts1holding one of those;the rest of each
nuts0holding one of those;every other leaf, grouped in
geoframes[1].
The intermediate geoframes are dropped. A ring like "rest of nuts1" spans
several nuts2, so the cut cannot nest with the geoframes it was carved
from; only geoframes[1] and the leaf geoframe 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",
geoframes = c("country", "state"))
geoscale_geoframes(z)
#> [1] "country" "zoom" "cell"
geoscale_regions(z, "zoom")
#> [1] "A1" "N1_rest" "N_rest" "S"
