I like to get the getFeatureInfo by a click like it is mentioned in this post so that the information is shown in a popup window. I tried trevis solution but it is not working for me. If I use addWMS() the WMS-layer is not visible and there is no info. If I use addWMSTiles() I don't get the getFeatureInfo Informations. Has anyone implemeted it correctly?

My code, after trevis post:


ui <- fluidPage(
   # Application title


server <- function(input, output) {
  output$mymap <- renderLeaflet({leaflet()  %>%
    addTiles(group = "base") %>%
    addWMS(baseUrl = "http://ows.terrestris.de/osm/service",
           layers = c("TOPO-WMS","OSM-Overlay-WMS"),
           # layers = c("OSM-Overlay-WMS"),
           group = "wmsgroup",
           options = leaflet::WMSTileOptions(
             transparent = TRUE,
             format = "image/png",
             info_format = "text/html",
             tiled = FALSE
           )) %>%
    addLayersControl(baseGroups = "base",
                     # overlayGroups = c("wmsgroup"))
                     overlayGroups = c("TOPO-WMS","OSM-Overlay-WMS"))

# Run the application 
shinyApp(ui = ui, server = server)

  • What actual WMS GetMap and GetFeatureInfo requests are sent? – nmtoken Jun 15 at 9:20
  • I found the problem. It works in the browser but not in the R-Studio Preview and I forgot to try it there. – Moemen Jun 15 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.