setWMSParams: Update WMS request parameters

View source: R/wms.R

setWMSParamsR Documentation

Update WMS request parameters

Description

Change WMS parameters such as time, styles or cql_filter on an existing layer without rebuilding the map. In Shiny, call this on leafletProxy.

Usage

setWMSParams(map, layerId = NULL, group = NULL, ...)

Arguments

map

a map widget object created from leaflet()

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.

...

Named WMS request parameters to set, for example time = "2022-11-10T21:00:00Z".

Value

the new map object

See Also

Other WMS Functions: addWMS()

Examples

library(leaflet)
library(leaflet.extras2)

leaflet() %>%
  addTiles() %>%
  addWMS(
    baseUrl = "https://gibs.earthdata.nasa.gov/wms/epsg3857/best/wms.cgi",
    layers = "MODIS_Terra_CorrectedReflectance_TrueColor",
    layerId = "modis",
    options = WMSTileOptions(format = "image/jpeg", time = "2022-11-10")
  ) %>%
  setWMSParams(layerId = "modis", time = "2022-11-11")

leaflet.extras2 documentation built on Sept. 10, 2026, 1:11 a.m.