library(tidyverse) library(routes) library(here) max_images <- 50 # download at most this many images
route_lat_lon <- read_rds(here("oregon", "data", "route_coords.rds"))
Only get images for at most r max_images
points on route:
every_nth <- ceiling(nrow(route_lat_lon)/max_images) route_lat_lon_sub <- route_lat_lon %>% slice(seq(1, nrow(route_lat_lon), by = every_nth))
Get all Street View images:
route_images <- route_lat_lon_sub %>% mutate( image = pmap_chr(list(lat = lat, lon = lon), possibly(get_img, NA_character_), dir = here("oregon", "images")) )
Write out image manifest:
route_images %>% write_rds(here("oregon", "images", "manifest.rds")) %>% write_csv(here("oregon", "images", "manifest.csv"))
Look at first and last images:
route_images %>% slice(1, n()) %>% pull(image) %>% walk(display_jpeg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.