The add_wms_*() functions are shorthand alternatives for a fully specified leaflet::addWMSTiles() or leaflet.extras2::addWMS() statement. Appropriate attribution is added to the Leaflet map depending on the layer.

add_wms_be_cartoweb(
  map,
  layer = c("topo", "topo_grey", "overlay", "crossborder"),
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE),
  ...
)

add_wms_be_ortho(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE),
  ...
)

add_wms_nl_ortho(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE),
  ...
)

add_wms_fl_grbmap(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE),
  ...
)

add_wms_fl_habitatmap(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 1200),
  add_wms_legend = FALSE,
  ...
)

add_wms_fl_habitatlabels(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE),
  ...
)

add_wms_fl_forestnature(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 600),
  add_wms_legend = FALSE,
  ...
)

add_wms_fl_agriculture(
  map,
  year,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 1200),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_nnb(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 600),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_natte_natuurparels(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 2000),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_ambitie_landschapstypen(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 2000),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_ambitie_natuurtypen(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html"),
  popupOptions = leaflet::popupOptions(maxWidth = 2000),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_landschapstypen(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html", minZoom = 13),
  popupOptions = leaflet::popupOptions(maxWidth = 2000),
  add_wms_legend = FALSE,
  ...
)

add_wms_nlnb_natuurtypen(
  map,
  options = leaflet::WMSTileOptions(format = "image/png", transparent = TRUE, info_format
    = "text/html", minZoom = 13),
  popupOptions = leaflet::popupOptions(maxWidth = 2000),
  add_wms_legend = FALSE,
  ...
)

Arguments

map

a map widget object created from leaflet()

layer

String that defines which layer to use, if the function supports more than one. In such case, the available strings are shown in the Usage section. The first value is used if missing.

options

a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements

...

Further arguments passed to leaflet::addWMSTiles() or leaflet.extras2::addWMS().

popupOptions

A Vector of popupOptions to provide popups

add_wms_legend

Logical. Is a legend to be added for this WMS? Note that the legend cannot be toggled on and off in the map; it is plotted as a separate, static legend.

year

Year to be applied in selecting the WMS

Value

A leaflet HTML widget object.

Details

On condition that these functions continue being maintained, using the shorthand functions should make your scripts more futureproof.

Abbreviations

Prefixes

be_

Belgium

fl_

Flanders

nl_

Netherlands

nlnb_

Netherlands: Province 'Noord-Brabant'

Suffixes

Background layers

_ortho

Orthophotographs

_cartoweb

Topographic Cartoweb layers (Belgium)

_grbmap

GRB basemap (Flanders; 'Grootschalig Referentiebestand')

Feature layers

_habitatmap

Natura 2000 habitat types

_habitatlabels

Natura 2000 habitat type labels

_forestnature

Public forest and nature areas managed by the Flemish Nature & Forest Agency

_agriculture

Parcels with the agricultural use in a specific year

_nnb

Netherlands; 'Natuurnetwerk Brabant (Rijk en Provincie NNB)'

_natte_natuurparels

Netherlands; 'Natte natuurparels'

_ambitie_landschapstypen

Netherlands; 'Natuurbeheerplan - Ambitiekaart Landschaptypen'

_ambitie_natuurtypen

Netherlands; 'Natuurbeheerplan - Ambitiekaart Natuurtypen'

_landschapstypen

Netherlands; 'Natuurbeheerplan - Beheertypenkaart_Landschaptypen'

_natuurtypen

Netherlands; 'Natuurbeheerplan - Beheertypenkaart Natuurtypen'

See also

Other topics on using web services: add_wmts_nl_brt(), get_coverage_wcs(), get_feature_wfs()

Author

Floris Vanderhaeghe, https://github.com/florisvdh

Examples

library(leaflet)
leaflet() |>
  setView(lng = 4.5, lat = 51.45, zoom = 11) |>
  add_wmts_nl_brt("grijs") |>
  add_wms_be_cartoweb("topo_grey") |>
  add_wms_fl_forestnature() |>
  add_wms_nlnb_nnb()
# It can also use mapview objects, if you first extract the leaflet map slot: library(mapview) #> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package, #> which was just loaded, will retire in October 2023. #> Please refer to R-spatial evolution reports for details, especially #> https://r-spatial.org/r/2023/05/15/evolution4.html. #> It may be desirable to make the sf package available; #> package maintainers should consider adding sf to Suggests:. #> The sp package is now running under evolution status 2 #> (status 2 uses the sf package in place of rgdal) kmi_stations <- sf::read_sf( system.file("extdata/kmi_stations.geojson", package = "inbospatial") ) mapview(kmi_stations, map.types = "CartoDB.Positron")@map |> add_wms_be_cartoweb()
# alternative syntax: if (FALSE) { mapview(kmi_stations, map.types = "CartoDB.Positron") |> _@map |> add_wms_be_cartoweb() }