Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wms-legend

Add WMS Legend


Description

Add a WMS Legend

Usage

addWMSLegend(map, uri, position = "topright", layerId = NULL)

Arguments

map

The leaflet map

uri

The legend URI

position

position of control: "topleft", "topright", "bottomleft", or "bottomright"

layerId

A unique ID for the Legend

Examples

leaflet(
  options = leafletOptions(
    center = c(-33.95293, 20.82824),
    zoom = 14,
    minZoom = 5,
    maxZoom = 18,
    maxBounds = list(
      c(-33.91444, 20.75351),
      c(-33.98731, 20.90626)
    )
  )
) %>%
  addWMSTiles(
    baseUrl = paste0(
      "http://maps.kartoza.com/web/?",
      "map=/web/Boosmansbos/Boosmansbos.qgs"
    ),
    layers = "Boosmansbos",
    options = WMSTileOptions(format = "image/png", transparent = TRUE),
    attribution = paste0(
      "(c)<a href= \"http://kartoza.com\">Kartoza.com</a> and ",
      "<a href= \"http://www.ngi.gov.za/\">SA-NGI</a>"
    )
  ) %>%
  addWMSLegend(
    uri = paste0(
      "http://maps.kartoza.com/web/?",
      "map=/web/Boosmansbos/Boosmansbos.qgs&&SERVICE=WMS&VERSION=1.3.0",
      "&SLD_VERSION=1.1.0&REQUEST=GetLegendGraphic&FORMAT=image/jpeg&LAYER=Boosmansbos&STYLE="
    )
  )

leaflet.extras

Extra Functionality for 'leaflet' Package

v1.0.0
GPL-3 | file LICENSE
Authors
Bhaskar Karambelkar [aut, cre], Barret Schloerke [aut], Bangyou Zheng [ctb] (Leaflet-search and Leaflet-GPS plugin integration), Robin Cura [ctb] (Fixes for Draw Options), Markus Voge [ctb] (Enhancements for Draw Options), Markus Dumke [ctb] (Bounce Marker addition), Mapbox [ctb, cph] (leaflet-omnivore, csv2geojson, and togeojson libraries), Henry Thasler [ctb, cph] (Leaflet.Geodesic library), Dennis Wilhelm [ctb, cph] (Leaflet.StyleEditor library), Kirollos Risk [ctb, cph] (fuse.js library), Tim Wisniewski [ctb, cph] (leaflet-choropleth library), Leaflet [ctb, cph] (leaflet-draw library), Alexander Milevski [ctb, cph] (leaflet-draw-drag library), John Firebaugh [ctb, cph] (leaflet-fullscreen library), Stefano Cudini [ctb, cph] (leaflet-gps library), Johannes Rudolph [ctb, cph] (leaflet-hash library), Per Liedman [ctb, cph] (leaflet-measure-path library), Pavel Shramov [ctb, cph] (leaflet-plugins library), Filip Zavadil [ctb, cph] (leaflet-pulse-icon library), Stefano Cudini [ctb, cph] (leaflet-search library), CliffCloud [ctb, cph] (leaflet-sleep library), Ursudio [ctb, cph] (leaflet-webgl-heatmap library), Maxime Hadjinlian [ctb, cph] (leaflet.BounceMarker library), Vladimir Agafonkin [ctb, cph] (leaflet.heat library), Iván Sánchez Ortega [ctb, cph] (leaflet.tilelayer.pouchdbcached library), Dale Harvey [ctb, cph] (pouchdb-browser library), Mike Bostock [ctb, cph] (topojson library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.