forked from rstudio/leaflet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addLayersControl.Rd
65 lines (54 loc) · 2.29 KB
/
addLayersControl.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layers.R
\name{addLayersControl}
\alias{addLayersControl}
\alias{layersControlOptions}
\alias{removeLayersControl}
\title{Add UI controls to switch layers on and off}
\usage{
addLayersControl(map, baseGroups = character(0),
overlayGroups = character(0), position = c("topright", "bottomright",
"bottomleft", "topleft"), options = layersControlOptions(),
data = getMapData(map))
layersControlOptions(collapsed = TRUE, autoZIndex = TRUE, ...)
removeLayersControl(map)
}
\arguments{
\item{map}{the map to add the layers control to}
\item{baseGroups}{character vector where each element is the name of a group.
The user will be able to choose one base group (only) at a time. This is
most commonly used for mostly-opaque tile layers.}
\item{overlayGroups}{character vector where each element is the name of a
group. The user can turn each overlay group on or off independently.}
\item{position}{position of control: "topleft", "topright", "bottomleft", or
"bottomright"}
\item{options}{a list of additional options, intended to be provided by
a call to \code{layersControlOptions}}
\item{data}{the data object from which the argument values are derived; by
default, it is the \code{data} object provided to \code{leaflet()}
initially, but can be overridden}
\item{collapsed}{if \code{TRUE} (the default), the layers control will be
rendered as an icon that expands when hovered over. Set to \code{FALSE}
to have the layers control always appear in its expanded state.}
\item{autoZIndex}{if \code{TRUE}, the control will automatically maintain
the z-order of its various groups as overlays are switched on and off.}
\item{...}{other options for \code{layersControlOptions()}}
}
\description{
Uses Leaflet's built-in
\href{http://leafletjs.com/reference-1.3.1.html#control-layers}{layers control}
feature to allow users to choose one of several base layers, and to choose
any number of overlay layers to view.
}
\examples{
\donttest{
leaflet() \%>\%
addTiles(group = "OpenStreetMap") \%>\%
addProviderTiles("Stamen.Toner", group = "Toner by Stamen") \%>\%
addMarkers(runif(20, -75, -74), runif(20, 41, 42), group = "Markers") \%>\%
addLayersControl(
baseGroups = c("OpenStreetMap", "Toner by Stamen"),
overlayGroups = c("Markers")
)
}
}