Learn R Programming

leaflet.extras2 (version 1.0.0)

addWMS: Add Queryable WMS Layer

Description

A Leaflet plugin for working with Web Map services, providing: single-tile/untiled/nontiled layers, shared WMS sources, and GetFeatureInfo-powered identify.

Usage

addWMS(
  map,
  baseUrl,
  layers = NULL,
  group = NULL,
  options = WMSTileOptions(),
  attribution = NULL,
  popupOptions = NULL,
  data = getMapData(map)
)

Arguments

map

a map widget object created from leaflet()

baseUrl

a base URL of the WMS service

layers

vector or list of WMS layers to show. The name of the layer is used as the layerId (for removeTiles purposes)

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.

options

List of further options. See WMSTileOptions

attribution

the attribution text of the tile layer (HTML)

popupOptions

List of popup options. See popupOptions. Default is NULL.

data

the data object from which the argument values are derived; by default, it is the data object provided to leaflet() initially, but can be overridden

Value

the new map object

References

https://github.com/heigeo/leaflet.wms

Examples

Run this code
# NOT RUN {
library(leaflet)
library(leaflet.extras2)

leaflet() %>%
  addTiles(group = "base") %>%
  setView(9, 50, 5) %>%
  addWMS(baseUrl = "https://maps.dwd.de/geoserver/dwd/wms",
         layers = "dwd:BRD_1km_winddaten_10m",
      popupOptions = popupOptions(maxWidth = 600),
      options = WMSTileOptions(
        transparent = TRUE,
        format = "image/png",
        info_format = "text/html"))
# }

Run the code above in your browser using DataLab