Skip to content

Instantly share code, notes, and snippets.

@ramnathv
Created February 5, 2014 02:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramnathv/275fe2a088e539f6b1ca to your computer and use it in GitHub Desktop.
Save ramnathv/275fe2a088e539f6b1ca to your computer and use it in GitHub Desktop.
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"
)
})
}
))
@jannes-m
Copy link

Hi Ramnath,

using your code I tried to embed in Shiny this HTML document http://bl.ocks.org/zross/raw/6a31f4ef9e778d94c204/ containing leaflet JavaScript commands. The map is shown but the animation is not. Do you have any idea, why this is?

library("shiny")
runApp(list(
ui = pageWithSidebar(
headerPanel('Map'),
sidebarPanel(""),
mainPanel(uiOutput('mymap'))
),
server = function(input, output){
output$mymap <- renderUI({
tags$iframe(
srcdoc = paste(readLines('http://bl.ocks.org/zross/raw/6a31f4ef9e778d94c204/'), collapse = '\n'),
width = "100%",
height = "600px"
)
})
}
))

I would greatly appreciate any help!

Kind regards,

Jannes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment