An icon can be represented as a list of the form list(color, iconSize,
...)
. This function is vectorized over its arguments to create a list of
icon data. Shorter argument values will be re-cycled. NULL
values for
these arguments will be ignored.
Usage
pulseIconList(...)
# S3 method for class 'leaflet_pulse_icon_set'
x[i]
makePulseIcon(
color = "#ff0000",
fillColor = color,
iconSize = 12,
animate = TRUE,
heartbeat = 1
)
pulseIcons(
color = "#ff0000",
fillColor = color,
iconSize = 12,
animate = TRUE,
heartbeat = 1
)
addPulseMarkers(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
icon = NULL,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
options = leaflet::markerOptions(),
clusterOptions = NULL,
clusterId = NULL,
data = leaflet::getMapData(map)
)
Arguments
- ...
icons created from
makePulseIcon()
- x
icons
- i
offset
- color
Color of the icon
- fillColor
Fill color of the icon
- iconSize
Size of Icon in Pixels.
- animate
To animate the icon or not, defaults to TRUE.
- heartbeat
Interval between each pulse in seconds.
- map
a map widget object created from
leaflet()
- lng
a numeric vector of longitudes, or a one-sided formula of the form
~x
wherex
is a variable indata
; by default (if not explicitly provided), it will be automatically inferred fromdata
by looking for a column namedlng
,long
, orlongitude
(case-insensitively)- lat
a vector of latitudes or a formula (similar to the
lng
argument; the nameslat
andlatitude
are used when guessing the latitude column fromdata
)- 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.- icon
the icon(s) for markers; an icon is represented by an R list of the form
list(iconUrl = "?", iconSize = c(x, y))
, and you can useicons()
to create multiple icons; note when you use an R list that contains images as local files, these local image files will be base64 encoded into the HTML page so the icon images will still be available even when you publish the map elsewhere- popup
a character vector of the HTML content for the popups (you are recommended to escape the text using
htmlEscape()
for security reasons)- popupOptions
A Vector of
popupOptions
to provide popups- label
a character vector of the HTML content for the labels
- labelOptions
A Vector of
labelOptions
to provide label options for each label. DefaultNULL
- options
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements
- clusterOptions
if not
NULL
, markers will be clustered using Leaflet.markercluster; you can usemarkerClusterOptions()
to specify marker cluster options- clusterId
the id for the marker cluster layer
- data
the data object from which the argument values are derived; by default, it is the
data
object provided toleaflet()
initially, but can be overridden
Examples
iconSet <- pulseIconList(
red = makePulseIcon(color = "#ff0000"),
blue = makePulseIcon(color = "#0000ff")
)
iconSet[c("red", "blue")]
#> $red
#> $color
#> [1] "#ff0000"
#>
#> $fillColor
#> [1] "#ff0000"
#>
#> $iconSize
#> [1] 12
#>
#> $animate
#> [1] TRUE
#>
#> $heartbeat
#> [1] 1
#>
#> attr(,"class")
#> [1] "leaflet_pulse_icon"
#>
#> $blue
#> $color
#> [1] "#0000ff"
#>
#> $fillColor
#> [1] "#0000ff"
#>
#> $iconSize
#> [1] 12
#>
#> $animate
#> [1] TRUE
#>
#> $heartbeat
#> [1] 1
#>
#> attr(,"class")
#> [1] "leaflet_pulse_icon"
#>
#> attr(,"class")
#> [1] "leaflet_pulse_icon_set"
leaflet() %>%
addTiles() %>%
addPulseMarkers(
lng = -118.456554, lat = 34.078039,
label = "This is a label",
icon = makePulseIcon(heartbeat = 0.5)
)
## for more examples see
# browseURL(system.file("examples/pulseIcon.R", package = "leaflet.extras"))