ohnoplus
ohnoplus

Reputation: 1325

trouble getting satellite maps with ggmap

The code recommended here, to download and plot a google map with ggmap works for me.

newmap4 <- get_map(location = c(-71.2612362452596,42.3308503846824
                            ,-71.0475647202879,42.4560226746649), source = 'google')

 p <- ggmap(newmap4)
 p

However, I'd really like to be able to be able to plot satellite maps, rather than terrain maps. I tried that as follows.

newmap5 <- get_map(location = c(-71.2612362452596,42.3308503846824
                            ,-71.0475647202879,42.4560226746649), source = 'google',
               maptype = "satellite")

 p <- ggmap(newmap5)
 p

In this case, the map that R prints out looks identical to the newmap 4 example above. Any advice?

 Sys.info()
 sysname 
                                      "Linux" 
                                      release 
                             "4.4.0-1083-aws" 
                                      version   "#93-Ubuntu SMP Wed May 8 16:08:41 UTC 2019" 
                                     nodename  "application-997622-deployment-3251181-722tz" 
                                      machine 
                                     "x86_64" 
                                        login 
                                    "unknown" 
                                         user 
                               "rstudio-user" 
                               effective_user 
                               "rstudio-user"

Upvotes: 2

Views: 579

Answers (1)

heds1
heds1

Reputation: 3448

Try the same code using get_googlemap() instead of get_map(). I'm not sure why that is required, since you specify that the source is Google. Have you registered your Google API key?

register_google(key = "<your key here>")
newmap5 <- get_googlemap(location = c(-71.2612362452596,42.3308503846824
                            ,-71.0475647202879,42.4560226746649), source = 'google',
               maptype = "satellite")
ggmap(newmap5)

map

Upvotes: 1

Related Questions