Takes a multi-layer SpatRaster (or a list of single-layer SpatRasters) and produces a self-contained leaflet htmlwidget. Each layer becomes a radio-selected base group; a draggable range slider is added that drives the radio buttons, so the user steps through years by dragging.

plotTimeSeriesLeaflet(
  x,
  palette = "viridis",
  rev = FALSE,
  layerName = "raster",
  sliderPosition = "bottomleft",
  legendPosition = "bottomright"
)

Arguments

x

One of:

  • a multi-layer SpatRaster – becomes one "object" named "raster"

  • a list of single-layer SpatRasters – same

  • a simList – reads ALL <obj>*.tif time-series from SpaDES.core::outputPath(x)

  • a length-1 character path to a directory of GeoTIFFs – same scan

For the disk-scan cases, files are grouped by base name (last regex match = time tag) into separate "objects". Each object becomes a radio-selectable layer in the UI.

palette

Palette name. Default "viridis". Tried first with terra::map.pal(), falling back to grDevices::hcl.colors().

rev

Reverse the palette? Default FALSE.

layerName

Short prefix used for each per-layer GeoTIFF filename (avoids collisions when multiple time-series sit on the same page).

sliderPosition

Leaflet control position for the object-radio + year-slider UI: "bottomleft" (default), "bottomright", "topleft", "topright".

legendPosition

Leaflet control position for the per-object colour legend. Default "bottomright".

Value

A leaflet htmlwidget with the slider injected via htmlwidgets::onRender(). Ships as static HTML – no Shiny server needed.

Details

Designed to ship in a Quarto / knitr static render – uses .leafletGeoTiffPath() internally so the per-layer GeoTIFFs are written into the qmd's _files/figure-html/ folder rather than tempfile().

See also

plotSAsLeaflet() for the single-snapshot case.