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.
Usage
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()orleaflet.extras2::addWMS().- popupOptions
A Vector of
popupOptionsto 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
Details
On condition that these functions continue being maintained, using the shorthand functions should make your scripts more futureproof.
Abbreviations
Suffixes
Background layers
_orthoOrthophotographs
_cartowebTopographic Cartoweb layers (Belgium)
_grbmapGRB basemap (Flanders; 'Grootschalig Referentiebestand')
Feature layers
_habitatmapNatura 2000 habitat types
_habitatlabelsNatura 2000 habitat type labels
_forestnaturePublic forest and nature areas managed by the Flemish Nature & Forest Agency
_agricultureParcels with the agricultural use in a specific year
_nnbNetherlands; 'Natuurnetwerk Brabant (Rijk en Provincie NNB)'
_natte_natuurparelsNetherlands; 'Natte natuurparels'
_ambitie_landschapstypenNetherlands; 'Natuurbeheerplan - Ambitiekaart Landschaptypen'
_ambitie_natuurtypenNetherlands; 'Natuurbeheerplan - Ambitiekaart Natuurtypen'
_landschapstypenNetherlands; 'Natuurbeheerplan - Beheertypenkaart_Landschaptypen'
_natuurtypenNetherlands; '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)
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) { # \dontrun{
mapview(kmi_stations, map.types = "CartoDB.Positron") |>
_@map |>
add_wms_be_cartoweb()
} # }