Add Time Slider to Leaflet
The LeafletSlider plugin enables you to dynamically add and remove Markers on a map by using a JQuery UI slider.
addTimeslider(map, data, options = timesliderOptions())
map |
a map widget |
data |
data must be a POINT Simple Feature with a time column. |
options |
List of additional options. See |
the new map object
Other Timeslider Functions:
removeTimeslider(),
timesliderOptions()
## Not run:
library(leaflet)
library(leaflet.extras2)
library(sf)
library(geojsonsf)
data <- sf::st_as_sf(leaflet::atlStorms2005[1,])
data <- st_cast(data, "POINT")
data$time = as.POSIXct(
seq.POSIXt(Sys.time() - 1000, Sys.time(), length.out = nrow(data)))
leaflet() %>%
addTiles() %>%
addTimeslider(data = data,
options = timesliderOptions(
position = "topright",
timeAttribute = "time",
range = TRUE)) %>%
setView(-72, 22, 4)
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.