R/ge.getGoogleMap.R

#' @usage ge.getGoogleMap(142.5, 43.5, 7, "hkd")
#'
ge.getGoogleMap <- function(lon, lat, zoom, prefix = "google"){
        ### ggmap 4 type of google map and save to Rds 08-15
        require(ggmap)
        x  <- deparse(substitute(lon))
        y  <- deparse(substitute(lat))
        z  <- deparse(substitute(zoom))
        now <- format(Sys.time(), "_%y%m%d_%H%M")
        for (i in c("terrain", "satellite", "roadmap", "hybrid")){
                fileName  <-  paste0(prefix,"_google_", i,"_",x,"_",y,"_zoom", z, now, ".Rds")
                file  <- get_googlemap(center = c(lon = lon, lat = lat), zoom = zoom,
                             maptype = i, filename = fileName)
                saveRDS(file, file = fileName)
         }
}
bwtian/geothermaR documentation built on May 13, 2019, 9:25 a.m.