addControl | R Documentation |
Add graphics elements and layers to the map widget.
addControl(
map,
html,
position = c("topleft", "topright", "bottomleft", "bottomright"),
layerId = NULL,
className = "info legend",
data = getMapData(map)
)
addTiles(
map,
urlTemplate = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
attribution = NULL,
layerId = NULL,
group = NULL,
options = tileOptions(),
data = getMapData(map)
)
addWMSTiles(
map,
baseUrl,
layerId = NULL,
group = NULL,
options = WMSTileOptions(),
attribution = NULL,
layers = "",
data = getMapData(map)
)
addPopups(
map,
lng = NULL,
lat = NULL,
popup,
layerId = NULL,
group = NULL,
options = popupOptions(),
data = getMapData(map)
)
addMarkers(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
icon = NULL,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = markerOptions(),
clusterOptions = NULL,
clusterId = NULL,
data = getMapData(map)
)
addLabelOnlyMarkers(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
icon = NULL,
label = NULL,
labelOptions = NULL,
options = markerOptions(),
clusterOptions = NULL,
clusterId = NULL,
data = getMapData(map)
)
addCircleMarkers(
map,
lng = NULL,
lat = NULL,
radius = 10,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = pathOptions(),
clusterOptions = NULL,
clusterId = NULL,
data = getMapData(map)
)
highlightOptions(
stroke = NULL,
color = NULL,
weight = NULL,
opacity = NULL,
fill = NULL,
fillColor = NULL,
fillOpacity = NULL,
dashArray = NULL,
bringToFront = NULL,
sendToBack = NULL
)
addCircles(
map,
lng = NULL,
lat = NULL,
radius = 10,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = pathOptions(),
highlightOptions = NULL,
data = getMapData(map)
)
addPolylines(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = FALSE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
smoothFactor = 1,
noClip = FALSE,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = pathOptions(),
highlightOptions = NULL,
data = getMapData(map)
)
addRectangles(
map,
lng1,
lat1,
lng2,
lat2,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
smoothFactor = 1,
noClip = FALSE,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = pathOptions(),
highlightOptions = NULL,
data = getMapData(map)
)
addPolygons(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
smoothFactor = 1,
noClip = FALSE,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = pathOptions(),
highlightOptions = NULL,
data = getMapData(map)
)
addGeoJSON(
map,
geojson,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
smoothFactor = 1,
noClip = FALSE,
options = pathOptions(),
data = getMapData(map)
)
addTopoJSON(
map,
topojson,
layerId = NULL,
group = NULL,
stroke = TRUE,
color = "#03F",
weight = 5,
opacity = 0.5,
fill = TRUE,
fillColor = color,
fillOpacity = 0.2,
dashArray = NULL,
smoothFactor = 1,
noClip = FALSE,
options = pathOptions()
)
map |
a map widget object created from |
html |
the content of the control. May be provided as string or as HTML generated with Shiny/htmltools tags |
position |
position of control: "topleft", "topright", "bottomleft", or "bottomright" |
layerId |
the layer id |
className |
extra CSS classes to append to the control, space separated |
data |
the data object from which the argument values are derived; by
default, it is the |
urlTemplate |
a character string as the URL template |
attribution |
the attribution text of the tile layer (HTML) |
group |
the name of the group the newly created layers should belong to
(for |
options |
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements |
baseUrl |
a base URL of the WMS service |
layers |
comma-separated list of WMS layers to show |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
icon |
the icon(s) for markers; an icon is represented by an R list of
the form |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
clusterOptions |
if not |
clusterId |
the id for the marker cluster layer |
radius |
a numeric vector of radii for the circles; it can also be a
one-sided formula, in which case the radius values are derived from the
|
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 |
bringToFront |
Whether the shape should be brought to front on hover. |
sendToBack |
whether the shape should be sent to back on mouse out. |
highlightOptions |
Options for highlighting the shape on mouse over. |
smoothFactor |
how much to simplify the polyline on each zoom level (more means better performance and less accurate representation) |
noClip |
whether to disable polyline clipping |
lng1 , lat1 , lng2 , lat2 |
latitudes and longitudes of the south-west and north-east corners of rectangles |
geojson |
a GeoJSON list, or character vector of length 1 |
topojson |
a TopoJSON list, or character vector of length 1 |
the new map
object
addControl()
: Add arbitrary HTML controls to the map
addTiles()
: Add a tile layer to the map
addWMSTiles()
: Add a WMS tile layer to the map
addPopups()
: Add popups to the map
addMarkers()
: Add markers to the map
addLabelOnlyMarkers()
: Add Label only markers to the map
addCircleMarkers()
: Add circle markers to the map
highlightOptions()
: Options to highlight a shape on hover
addCircles()
: Add circles to the map
addPolylines()
: Add polylines to the map
addRectangles()
: Add rectangles to the map
addPolygons()
: Add polygons to the map
addGeoJSON()
: Add GeoJSON layers to the map
addTopoJSON()
: Add TopoJSON layers to the map
The Leaflet API documentation: https://web.archive.org/web/20220702182250/https://leafletjs.com/reference-1.3.4.html
tileOptions
, WMSTileOptions
,
popupOptions
, markerOptions
,
pathOptions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.