Closed ajpelu closed 1 year ago
HI @ajpelu:
For interactive (i.e. Leaflet maps) the solution is quite straightforward, while for static maps in R it is more complex.
In first place, let me tell you that I am planning a new release of mapSpain on the next weeks, so if you want to add new providers you may consider a pull request to the plugin in dev and I would happily add those providers both to this plugin and to mapSpain:
In the meantime, you can do the following:
You really don't need mapSpain for this, let me show you how (although you may already know this).
Lets say we want to add https://www.ideandalucia.es/wms/ortofoto2016?request=GetCapabilities&service=WMS ("ortofotografia_2016_pancromatico") layer (search for queryable=
to see the <Name>
of the layers).
On Leaflet.js use L.tileLayer.wms()
:
In R use the leaflet package:
library(leaflet)
leaflet() %>%
setView(
lat = 37.17634,
lng = -3.58821,
zoom = 7
) %>%
addProviderTiles("OpenStreetMap", group = "OpenStreetMap") %>%
addWMSTiles("https://www.ideandalucia.es/wms/ortofoto2016?",
layers = "ortofotografia_2016_pancromatico",
options = WMSTileOptions(
format = "image/png",
transparent = TRUE,
attribution = "IDEAndalucia"
),
group = "Junta Andalucia"
) %>%
addLayersControl(
baseGroups = "OpenStreetMap",
overlayGroups = "Junta Andalucia",
options = layersControlOptions(collapsed = FALSE)
)
Continues on https://github.com/rOpenSpain/mapSpain/issues/86
Thanks @dieghernan for your detailed reply. Yes, I know how to add wms in leaflet and in R, but thanks for the examples.
About the next release of mapSpain, I'll try to add some new providers.
Thanks AntonioJ
Hi @ajpelu , just wanted to check if you saw https://github.com/rOpenSpain/mapSpain/issues/86
Regards
Hi @dieghernan Thanks a lot. This is just what I was looking for.
Hi @dieghernan Thanks for this plugin. I've used this extension to add base maps directly in leaflet, but also I would like to use as base maps in R, using the amazing mapSpain pkg. I read the documentation and I see how to do it, but I didn't find any way to include custom WMS, for instance from other institutions (e.g. from Junta de Andalucía).
Any suggestions?
Thanks and sorry for this mixed questions.