CombinePolygons | R Documentation |
The function combines polygons to one single spatial polygon object, according to the ID vector that specifies which input polygons belong to which output polygon.
CombinePolygons(map, g)
CombineKant(id, g, map = GetMap("kant.map"))
CombinePolg(id, g, map = GetMap("polg.map"))
map |
the map containing the regions to be combined. |
id |
the id of the cantons or communities to be aggregated. |
g |
a vector defining the assignment of the elements to the output polygons to be created. It may contain |
Returns an aggregated spatial polygons object named with the aggregated IDs values in their sorting order; see the ID values of the output object to view the order.
Juerg Guggenbuehl, Andri Signorell <andri@signorell.net>
st_union
require(DescTools)
try( {
# Representation of the language areas in CH combined via cantons
# by majority per canton
tkt <- table(d.bfsrg$kt_c, d.bfsrg$sprgeb_x)
grp <- unique(d.bfsrg$sprgeb_x)[apply(tkt, 1, which.max)]
# combine and plot cantons
plot(CombineKant(rownames(tkt), grp), col=SetAlpha(c(horange, hyellow, hecru), 0.8),
border="grey40", main="Languages in CH")
# copyright is mandatory for these SFSO maps
BfSStamp()
# waters make the maps more realistic ...
AddLakes(col = "grey80", border = "grey40")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.