1

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?

chamaoskurumi
  • 2,271
  • 2
  • 23
  • 30
  • I have contacted the [author](http://www.grf.bg.ac.rs/fakultet/pro/e?nid=168) of the `plotGoogleMaps` package and this is what he said: _I don't use shinyapp at the moment I don't have time to look at it, plotGoogleMaps produce legend as .png you should manage to embed the legend in the iframe generated inside shinyapp. I'll be producing new version of package, maybe I'll have time to make it easier to work with shiny, but I can not promise it. plotGoogleMaps is just my hobby :)_ – chamaoskurumi Jun 07 '14 at 16:45

0 Answers0