Map - polygons - Create leaflet map from shapefile, in shiny app
Source:R/MAP_FUNCTIONS.R
map_shapes_leaflet.RdMap - polygons - Create leaflet map from shapefile, in shiny app
Usage
map_shapes_leaflet(
shapes,
color = "green",
popup = NULL,
fillOpacity = 0.5,
...,
popup_style = "auto"
)Arguments
- shapes
like from shapes_counties_from_countyfips(fips_counties_from_state_abbrev("DE")), or at least a data.frame that can be interpreted as indicating points via
shapefile_from_sitepoints()- color
passed to
leaflet::addPolygons()- popup
passed to
leaflet::addPolygons()- fillOpacity
passed to
leaflet::addPolygons()- ...
passed to
leaflet::addPolygons(), such as opacity=1- popup_style
used only if
popupis NULL:"auto","full","short", or"none"(no popups). Seemap_popup_style().
Details
Each polygon's layerId is its row number in shapes, so the web app can build
the popup for a shape when it is clicked. If there are more than
default_max_shapes_map_unsimplified shapes, they are simplified for the map
(see map_shapes_simplified()).
Examples
out = testoutput_ejamit_10pts_1miles
out$results_bysite = out$results_bysite[1:2,]
map_shapes_leaflet(
ejam2shapefile(out, save = FALSE),
popup = popup_from_ejscreen(out$results_bysite)
)