.html plotGoogleMap does not load in shiny App when deployed on shinyapps.io

28 views
Skip to first unread message

Regiane Smo

unread,
Jun 11, 2014, 3:02:09 PM6/11/14
to shinyap...@googlegroups.com

I am trying to embed a plotGoogleMap in a shiny app online. Locally the app works perfectly, but when uploading via shinyapps to shinyapps.io the .html map does not load.

This is how the app looks like with the unloaded .html map:

https://chamaoskurumi.shinyapps.io/TESTmapSHINY/

Any ideas how to solve this issue?


See my code below.


ui.R

library('markdown')
library('shiny')

shinyUI(navbarPage("plotGooleMaps in shinyapps",
                   mainPanel(uiOutput('mymap'))
                  )
       )


server.R

library('shiny')
library('plotGoogleMaps')

shinyServer(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 = "900Px",
      height = "500Px"
      )
  })
})


deploy app with shinyapps

library('shinyapps')
setwd("~/working directory where ui.R and server.R are located locally")
deployApp()

----------------------------------------
This is the error log that I can't decipher:

[blocked] The page at 'about:srcdoc' was loaded over HTTPS, but ran insecure content from 'http://maps.google.com/maps/api/js?sensor=false': this content should also be loaded over HTTPS. about:srcdoc:1
  1. Uncaught ReferenceError: google is not defined about:srcdoc:21
  1. Uncaught ReferenceError: google is not defined about:srcdoc:1989

PS: I posted the same question on stackoverflow.

Joe Cheng

unread,
Jun 11, 2014, 3:16:45 PM6/11/14
to Regiane Smo, shinyap...@googlegroups.com
The reference to http://maps.google.com should be changed to either https://maps.google.com or //maps.google.com. You may have to ask the plotGoogleMaps package author to make this change.


--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/a7dfed61-1520-430a-8c12-471594fa9880%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joe Cheng

unread,
Jun 11, 2014, 3:20:13 PM6/11/14
to Regiane Smo, shinyap...@googlegroups.com
Actually in the meantime you might be able to replace this:

readLines('myMap1.html')

with this:

gsub("http://maps.google.com/", "https://maps.google.com/", readLines('myMap1.html'), fixed=TRUE)

Regiane Smo

unread,
Jun 12, 2014, 10:27:15 AM6/12/14
to shinyap...@googlegroups.com, aptobri...@gmail.com
Wow Joe,

gsub("http://maps.google.com/", "https://maps.google.com/", readLines('myMap1.html'), fixed=TRUE)

worked perfectly! Thanks!

See my App here if you are interested:
https://chamaoskurumi.shinyapps.io/mapsSHINY_shopping/
Reply all
Reply to author
Forward
0 new messages