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())
a map widget
data must be a POINT Simple Feature with a time column.
List of additional options. See timesliderOptions
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)
# }
Run the code above in your browser using DataLab