addMovingMarker | R Documentation |
The function expects either line or point data as spatial data or as Simple Feature. Alternatively, coordinates can also be passed as numeric vectors.
addMovingMarker(
map,
lng = NULL,
lat = NULL,
layerId = NULL,
group = NULL,
duration = 2000,
icon = NULL,
popup = NULL,
popupOptions = NULL,
label = NULL,
labelOptions = NULL,
movingOptions = movingMarkerOptions(),
options = leaflet::markerOptions(),
data = leaflet::getMapData(map)
)
map |
the map to add moving markers |
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 |
layerId |
In order to be able to address the moving markings individually, a layerId is required. If none is specified, one is created that is derived from the current timestamp. |
group |
the name of the group the newly created layers should belong to
(for |
duration |
Duration in milliseconds per line segment between 2 points.
Can be a vector or a single number. Default is |
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 |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
movingOptions |
a list of extra options for moving markers.
See |
options |
a list of extra options for markers. See
|
data |
the data object from which the argument values are derived; by
default, it is the |
the new map
object
https://github.com/ewoken/Leaflet.MovingMarker
Other MovingMarker Functions:
movingMarkerOptions()
,
startMoving()
library(sf)
library(leaflet)
library(leaflet.extras2)
df <- sf::st_as_sf(atlStorms2005)[1,]
leaflet() %>%
addTiles() %>%
addPolylines(data = df) %>%
addMovingMarker(data = df,
movingOptions = movingMarkerOptions(autostart = TRUE, loop = TRUE),
label="I am a pirate!",
popup="Arrr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.