1

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)

2 Answers 2

3

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)
2
  • Thanks for the answer. I guess it threw me that layer 1 (in a European land cover map) would be covering Guadelope, of all places!
    – Simon
    Commented Jul 30, 2020 at 11:46
  • 1
    The layer names are not very helpful!
    – Spacedman
    Commented Jul 30, 2020 at 12:20
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.