.png legend of plotGoogleMaps not displayed in R shiny App

327 views Asked by At

I would like to embend a map produced with plotGoogleMap (= a .html output external to R) in a shiny App. Thanks to ramnathv's code I managed to do so.

However, unfortunately the legend does not display on the map. It seems the legend is a .png file which takes a different name everytime it's run. I have found this discussion on another forum, but they could not solve the issue.

Try out this minimum example to see for yourself that the legend is missing:

library(plotGoogleMaps)
library(shiny)

runApp(list(
  ui = pageWithSidebar(
   headerPanel('Map'),
   sidebarPanel(""),
   mainPanel(uiOutput('mymap'))
   ),
   server = function(input, output){
    output$mymap <- renderUI({
      data(meuse)
      coordinates(meuse) = ~x+y
      proj4string(meuse) <- CRS("+init=epsg:28992")
      m <- plotGoogleMaps(meuse, filename = 'myMap1.html', openMap = F)
      tags$iframe(
        srcdoc = paste(readLines('myMap1.html'), collapse = '\n'),
        width = "100%",
        height = "600px"
      )
    })
   }
))

Any suggestions how to solve this issue?

0

There are 0 answers