google_streetview: Google street view

View source: R/google_streetview.R

google_streetviewR Documentation

Google street view


Displays a static street view image from Google Maps Street View Image API


  location = NULL,
  panorama_id = NULL,
  size = c(400, 400),
  heading = NULL,
  fov = 90,
  pitch = 0,
  output = c("plot", "html"),
  response_check = FALSE,
  signature = NULL,
  key = get_api_key("streetview")



numeric vector of lat/lon coordinates, or an address string.


a specific panorama ID.


numeric vector of length 2, specifying the output size of the image in pixels, given in width x height. For example, c(600, 400) returns an image 600 pixles wide and 400 pixles high.


indicates the compass heading of the camera. Accepted values are from 0 to 360 (both 0 and 360 indicate north), 90 indicates east, 180 south and 270 west. If no heading is specified a value will be calculated that directs the camera to wards the specified location, from the point at which the closest photograph was taken.


determines the horizontal field of view of the image. The field of view is expressed in degrees, with a maximum allowed value of 120. When dealing with a fixed-size viewport, as with Street View image of a set size, field of view in essence represents zoom, with small numbers indicating a higher level of zoom


specifies the up or down angle of the camera relative to the Street View vehicle. This is often, but not always, flat horizontal. Positive values angle the camera up (with 90 degrees indicating straight up); negative values angle the camera down (with -90 indicating straight down)


specifies whether the result should be displayed in R's viewer, or embedded as HTML inside a webpage.


logical indicating if the function should first check if the image is available. If TRUE and no image is available, a warning message is printed and no image will be downloaded. if FALSE and no image is available, a blank image will be displayed saying 'Sorry, we have no imagery here'.


a digitial signature used to verify that any site generating requests using your API key is authorised to do so. See Google Documentation for further details


string. A valid Google Developers Street View Image API key


## Not run: 

## download and display an image
# key <- "your_api_key"
google_streetview(location = c(-37.817714, 144.96726),
    size = c(400,400), output = "plot",
    key = key)

## no response check - display 'sorry' message
google_streetview(location = c(-37.8, 144),
   size = c(400,400),
   panorama_id = NULL,
   output = "plot",
   heading = 90,
   fov = 90,
   pitch = 0,
   response_check = FALSE,
   key = key)

## embed an image of Flinders Street Station into a Shiny webpage

ui <- fluidPage(
  uiOutput(outputId = "myStreetview")

server <- function(input, output){
  key <- "your_api_key"

  output$myStreetview <- renderUI({
    tags$img(src = google_streetview(location = c(-37.817714, 144.96726),
                                     size = c(400,400), output = "html",
                                     key = key),  width = "400px", height = "400px")

shinyApp(ui, server)

## End(Not run)

googleway documentation built on Aug. 22, 2023, 9:13 a.m.