I am trying to create a web application with integrated Google Street View using the RStudio Shiny library; but could not get a view of the street to display in the application. I used an example of JavaScript and HTML: https://developers.google.com/maps/documentation/javascript/examples/streetview-embed which I insert here:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Street View containers</title> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> <script> function initialize() { var bryantPark = new google.maps.LatLng(37.869260, -122.254811); var panoramaOptions = { position: bryantPark, pov: { heading: 165, pitch: 0 }, zoom: 1 }; var myPano = new google.maps.StreetViewPanorama( document.getElementById('map-canvas'), panoramaOptions); myPano.setVisible(true); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body> </html>
My ui and server scripts:
ui.R
shinyUI(fluidPage( titlePanel("Google StreetView"), mainPanel( uiOutput("inc") ) ))
and
server.R
library(shiny) shinyServer(function(input, output) { getPage<-function() { return(includeHTML("googleStreetViewContainer.html")) } output$inc<-renderUI({getPage()}) })
I tried several different versions of the ui.R and server.R files, using includeHTML directly in the ui.R file, not defining the getPage function, and also using the $ script tags in the ui.R file.
I did not have any errors, but Street View is not a rendering. Any ideas?
source share