Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pulseMarkers

Make pulse-icon set


Description

Make pulse-icon set

Make Pulse Icon

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.

Add Pulse Markers

Usage

pulseIconList(...)

## S3 method for class 'leaflet_pulse_icon_set'
x[i]

makePulseIcon(color = "#ff0000", iconSize = 12, animate = TRUE,
  heartbeat = 1)

pulseIcons(color = "#ff0000", 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

iconSize

Size of Icon in Pixels.

animate

To animate the icon or not, defaults to TRUE.

heartbeat

Interval between each pulse in seconds.

map

the map to add pulse Markers to.

lng

a numeric vector of longitudes, or a one-sided formula of the form ~x where x is a variable in data; by default (if not explicitly provided), it will be automatically inferred from data by looking for a column named lng, long, or longitude (case-insensitively)

lat

a vector of latitudes or a formula (similar to the lng argument; the names lat and latitude are used when guessing the latitude column from data)

layerId

the layer id

group

the name of the group the newly created layers should belong to (for clearGroup and addLayersControl 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;

popup

a character vector of the HTML content for the popups (you are recommended to escape the text using htmlEscape() for security reasons)

popupOptions

options for popup

label

a character vector of the HTML content for the labels

labelOptions

A Vector of labelOptions to provide label options for each label. Default NULL

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 use markerClusterOptions() 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 to leaflet() initially, but can be overridden

Examples

iconSet = pulseIconList(
  red = makePulseIcon(color = "#ff0000"),
  blue = makePulseIcon(color = "#0000ff")
)

iconSet[c("red", "blue")]

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/pluseIcon.R", package = "leaflet.extras"))

leaflet.extras

Extra Functionality for 'leaflet' Package

v1.0.0
GPL-3 | file LICENSE
Authors
Bhaskar Karambelkar [aut, cre], Barret Schloerke [aut], Bangyou Zheng [ctb] (Leaflet-search and Leaflet-GPS plugin integration), Robin Cura [ctb] (Fixes for Draw Options), Markus Voge [ctb] (Enhancements for Draw Options), Markus Dumke [ctb] (Bounce Marker addition), Mapbox [ctb, cph] (leaflet-omnivore, csv2geojson, and togeojson libraries), Henry Thasler [ctb, cph] (Leaflet.Geodesic library), Dennis Wilhelm [ctb, cph] (Leaflet.StyleEditor library), Kirollos Risk [ctb, cph] (fuse.js library), Tim Wisniewski [ctb, cph] (leaflet-choropleth library), Leaflet [ctb, cph] (leaflet-draw library), Alexander Milevski [ctb, cph] (leaflet-draw-drag library), John Firebaugh [ctb, cph] (leaflet-fullscreen library), Stefano Cudini [ctb, cph] (leaflet-gps library), Johannes Rudolph [ctb, cph] (leaflet-hash library), Per Liedman [ctb, cph] (leaflet-measure-path library), Pavel Shramov [ctb, cph] (leaflet-plugins library), Filip Zavadil [ctb, cph] (leaflet-pulse-icon library), Stefano Cudini [ctb, cph] (leaflet-search library), CliffCloud [ctb, cph] (leaflet-sleep library), Ursudio [ctb, cph] (leaflet-webgl-heatmap library), Maxime Hadjinlian [ctb, cph] (leaflet.BounceMarker library), Vladimir Agafonkin [ctb, cph] (leaflet.heat library), Iván Sánchez Ortega [ctb, cph] (leaflet.tilelayer.pouchdbcached library), Dale Harvey [ctb, cph] (pouchdb-browser library), Mike Bostock [ctb, cph] (topojson library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.