Geographic Information Systems Asked on February 17, 2021
I’m trying to add Corine land cover data to a shiny
leaflet
map. However, I’m struggling to decipher the WMS XML data so that I can include the appropriate server URL and layer. The WMS information can be found here and here.
I’ve included and MRE below of what I thought the correct details should be to display Corine 2018 landcover data but I just get a grey leaflet
map.
If unable to provide a straight up solution to this question, can someone help me to interpret the XML data so that I can do this in future for other WMS providers?
library(shiny)
library(leaflet)
ui <- fluidPage(
# Application title
titlePanel("Map"),
sidebarLayout(
sidebarPanel(),
mainPanel(
leafletOutput("map")
)
)
)
server <- function(input, output) {
output$map<-renderLeaflet({
leaflet() %>%
addWMSTiles( "https://image.discomap.eea.europa.eu/arcgis/services/Corine/CLC2018_WM/MapServer/WmsServer", layers = "1",
options = WMSTileOptions(format = "image/png", transparent = T)) %>%
setView(lng = -1.8, lat = 52.0, zoom = 5)
})
}
# Run the application
shinyApp(ui = ui, server = server)
layer 1 is Guadeloupe. In the metadata XML:
<Layer queryable="1">
<Name>1</Name>
<Title>U2018_CLC2018_V2020_20u1_FR_GLP_R_WM</Title>
which then goes:
<westBoundLongitude>-61.906490</westBoundLongitude>
<eastBoundLongitude>-60.904868</eastBoundLongitude>
<southBoundLatitude>15.735481</southBoundLatitude>
<northBoundLatitude>16.607732</northBoundLatitude>
Layer 12 has main European coverage:
<Name>12</Name>
<Title>Corine Land Cover 2018 raster</Title>
...
<westBoundLongitude>-56.505142</westBoundLongitude>
<eastBoundLongitude>72.906158</eastBoundLongitude>
<southBoundLatitude>24.283655</southBoundLatitude>
<northBoundLatitude>72.664410</northBoundLatitude>
Its easier to test this without firing up a shiny server with plain leaflet:
url = "https://image.discomap.eea.europa.eu/arcgis/services/Corine/CLC2018_WM/MapServer/WmsServer"
leaflet() %>%
addWMSTiles( url, layers = "12",
options = WMSTileOptions(format = "image/png", transparent = T)) %>%
setView(lng = -1.8, lat = 52.0, zoom = 5)
Correct answer by Spacedman on February 17, 2021
I think I solved it. The URL is correct but the layer name should have been "12" (not "1" as in my answer above). For those that may struggle to interpret these WMS XML files in future, I would recommend using QGIS (or similar) to get an easy-to-read list of WMS files e.g. http://www.qgistutorials.com/en/docs/working_with_wms.html
Answered by Simon on February 17, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP