1
votes

I need a help with get_map Function , Every time i use it , i can't download the the map

Example:

get_map('Egypt',zoom = 'auto')

Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") : cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=Egypt&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false' In addition: Warning message: In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") : cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=Egypt&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'

1
Did you manage to resolve it? - Roman
I decided to use leaflet package instead of it since this service unfortunately became not free - Mo'men Mohamed

1 Answers

1
votes

ggmap is using Google Maps as its standard map source.

At the moment, the Google Maps API that ggmap is connecting to needs lon/lat coordinates (e.g., location = c(16.3738,48.2082) - not a location name) and a functioning and registered Google Maps API key (that you register via register_google(key = "...") in every new session) to get a map.

So, the full code for you would be

library(ggmap)
register_google(key = "...") # with your billing-enabled API key entered here
map <- get_map(location = c(31.2357,30.0444), zoom = 5)
ggmap(map)

egypt plot

For further troubleshooting pointers, see this issue on Github.