Adds a Leaflet map to a webpage, based on specified or selected inputs.
Usage
output_map(shapes = NULL, overlays = NULL, color = NULL,
color_time = NULL, dataview = NULL, id = NULL, click = NULL,
subto = NULL, background_shapes = NULL, options = list(),
overlays_from_measures = TRUE, tiles = list(url =
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", options = list(maxZoom
= 19)), attribution = list(name = "OpenStreetMap", url =
"https://www.openstreetmap.org/copyright"))
Arguments
- shapes
A list or list of lists specifying GeoJSON files. Each list should have at least a
url
entry (the URL of the file), and will need aname
entry (associating it with one of the site's datasets) if the site has multiple datasets. The file's features must each have aproperties
field containing an ID found in the data -- by default this is assumed to be called"geoid"
, but this can be specified with anid_property
entry in the list. For exampleshapes = list(name = "data",
url = "https://example.com/shapes.geojson", id_property = "id")
. Atime
entry can also specify different maps for the same dataset, based on the selected time, along with aresolution
entry to specify how to match the year; either"decade"
(default) or"exact"
.- overlays
additional layers to add to the map, based on the selected variable; a list or list of lists with entries at least for
variable
(name of the variable associated with the layer) andsource
(path to the layer file, or a list with entries includingurl
andtime
). Entries can also include afilter
entry, with a list or list of lists of conditions, including entries forfeature
(name of the feature on which to condition entity inclusion),operator
, andvalue
.- color
The name of a variable, or id of a variable selector, to be used to color polygons.
- color_time
The ID of a selector to specify which timepoint of
color
to use.- dataview
The ID of an
input_dataview
component.- id
Unique ID for the map.
- click
The ID of an input to set to a clicked polygon's ID.
- subto
A vector of output IDs to receive hover events from.
- background_shapes
The name of a dataset (shapes) to show within a selection, regardless of selected dataset. Useful to show lower-level regions within higher-level regions.
- options
A list of configuration options, potentially extracted from a saved leaflet object (see Leaflet documentation).
- overlays_from_measures
Logical; if
TRUE
, will look for overlay information in measurement information.- tiles
A list or list of lists containing provider information (see leaflet providers; e.g.,
list(
url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
,options = list(maxZoom = 19))
).- attribution
A list with tile attribution information to be included in a credits section. To add attributions to the map, include them in
tile
'soptions
list.