How can I download google maps of a certian area and use it for my plot [R]? -


i trying use lat-log data plot on google maps. tried download google maps , use plotting values.

here's how tried download couldn't understand function properly:

let's say:

data.lat.long <- data.frame(lat=c(2,3,4,5,6,7,3,7,8,9,2),long=c(3,7,8,9,2,1,2,3,4,5,6),c=c(1,1,1,2,2,1,1,1,1,2,2))  data <- data.lat.long %>% mutate(mean_lat = mean(latitude)) %>% mutate(mean_long = mean(longitude))  library(rgooglemaps) getmap(center = c(lat = data$meanlatitude, lon = data$meanlongitude),  size = c(640, 640), destfile = "c:/m/googlemaps/", zoom = 12, sensor = "true", maptype = c("terrain"),format = c("gif"), returnimage = true, grayscale = false, newmap = true, scale = 1, api_console_key = null, verbose = 0) 

what trying is: have calculated max , min lat-long points. , want download region [from maximum latitude minimum latitude & maximum longitude minimum longitude].

basic usage ggmap:

library(dplyr) library(ggmap) library(ggthemes)  data.lat.long <- data.frame(lat=c(2,3,4,5,6,7,3,7,8,9,2),                             long=c(3,7,8,9,2,1,2,3,4,5,6),                             c=c(1,1,1,2,2,1,1,1,1,2,2))  data.lat.long %>%   mutate(mean_lat = mean(lat),          mean_long = mean(long)) -> dat  # use variables in own code, pref bounding box vs centroid # makes possible not rely on zoom param  loc <- get_map(c(lon=4.545455, lat=5.090909), zoom=4)  gg <- ggmap(loc) gg <- gg + geom_point(data=data.lat.long,                       aes(x=long, y=lat),                       size=3, color="black") gg <- gg + theme_map() gg 

enter image description here


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -