Displays large polygon/line datasets as tiled vector features using
Leaflet.VectorGrid
(L.vectorGrid.slicer). This is more efficient than
addPolygons for big GeoJSON.
Usage
addVectorgrid(
map,
data,
layerId = NULL,
group = NULL,
featureId = NULL,
popup = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
options = pathOptions(),
interactive = TRUE
)Arguments
- map
a map widget object created from
leaflet()- data
An
sf/Spatialobject, a GeoJSON object, or a URL returning GeoJSON / TopoJSON.- layerId
the layer id
- group
the name of the group the newly created layers should belong to (for
clearGroup()andaddLayersControl()purposes). Human-friendly group names are permitted–they need not be short, identifier-style names. Any number of layers and even different types of layers (e.g., markers and polygons) can share the same group name.- featureId
Formula or vector of unique feature ids (used for highlight and the Shiny click
id). A formula passed aslayerIdis treated asfeatureId.- popup
Formula, column name or character vector with HTML for the click popup.
- stroke
whether to draw stroke along the path (e.g., the borders of polygons or circles)
- color
stroke color
- weight
stroke width in pixels
- opacity
stroke opacity (or layer opacity for tile layers)
- fill
whether to fill the path with color (e.g., filling on polygons or circles)
- fillColor
fill color
- fillOpacity
fill opacity
- dashArray
a string that defines the stroke dash pattern
- options
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements
- interactive
Whether the layer fires mouse events. Default
TRUE.
Details
In Shiny a click updates input$MAPID_vectorgrid_click with
id, group, lat, lng and properties.
See also
Other Vectorgrid Functions:
addProtobuf(),
clearVectorgrid(),
removeVectorgrid(),
vectorStyling()