r-tmap / tmap

R package for thematic maps
https://r-tmap.github.io/tmap
GNU General Public License v3.0
865 stars 121 forks source link

Add support for WMS layer in tm_raster #502

Open marionowak opened 4 years ago

marionowak commented 4 years ago

Is it possible to add a raster WMS layer as background for a map? I think this could be added to tm_rgb(). Similar to leaflet::addWMSTiles():

leaflet(map) %>%
  addTiles() %>%
  setView(lng = 8.21831, lat = 56.78995, zoom = 15) %>%
  addWMSTiles(
    map="WMS_URL",
    layers = "layer name", 
    options = WMSTileOptions(format = "image/png", transparent = TRUE),
    attribution = ""
  )
mtennekes commented 4 years ago

Great idea! Do you think it can also be used in plotting mode? I'm not very familiar with WMS yet, but from what I've read, it should be possible. I used to have the distinction between zoom-dependent tiles (tm_basemap/tm_tiles) on the one hand, and static images on the other (tm_raster/tm_rgb), but it seems WMS could serve both.

Does any of you have a reproducible example of using WMS in R?

tim-salabim commented 4 years ago

There's a nice example here, though only interactive...