Build a leaflet map from a shapefile in a context of multiple map sets and corresponding shapefiles.
build_mapset(shp, all_regions, ids, mapset, mapsets, default = "", default.name = default, all_locs_shapefile, xyz, color = c("#000000", "#000000", "#3C8DBC"), fill = c("#000000", "#3C8DBC", "#3C8DBC"), color_opacity = c(0.5, 1, 1), fill_opacity = c(0, 0, 0.4), progress = F)
shp | a shapefile pertaining to a single |
---|---|
all_regions | a named vector of region IDs pertaining to regions in |
ids | literal names of regions in |
mapset | character, name of a mapset in |
mapsets | character, vector of all available map sets. |
default | name of a default map set, if used. Otherwise defaults to |
default.name | label used in place of |
all_locs_shapefile | a named list (names match |
xyz | a named list (names match |
color | vector of three polygon border colors. See details. |
fill | vector of three polygon fill colors. See details. |
color_opacity | numeric vector of three polygon border color opacities. See details. |
fill_opacity | numeric vector of three polygon fill color opacities. See details. |
progress | logical, add progress bar in app during map rendering. Helpful is rendering is slow. |
a leaflet map
This function builds a leaflet map from a shapefile. There can be a list of shapefiles, and corresponding lists of map set names and parameters for setting up each map such as centering and zooming defaults.
Each mapset
and shp
may contain named subregions/polygons. Polygons have fill color, outline, and
change appearance on mouse hover and click (selection).
A default
map may be identified, and if so, it is assumed to be a simpler base map with only a single polygon.
Such a map set has one region, and therefore is fully colored as permanently "selected", with no need to click a polygon.
Polygon border and fill colors and opacities are vectors of three values each.
These correspond to unselected, highlighted and selected polygons, respectively.
While build_mapset
deals primarily with unselected or highlighted polygons and update_mapset
deals strictly with selected polygons, build_mapset
still takes a third value because this is used
in the case of a default
map set consisting of a single polygon (which is always colored and filled as a "selected" polygon).
#not run