I have a piece of code which all of the sudden stopped working. As simple as that. I found some vague answers on SO, but nothing is helping in my case.
library(ggmap)
myLocation <- c(21.5, -18.5, 34, -8)
myMap <- get_map(location=myLocation,
source="google", maptype="terrain", crop=FALSE, color="bw")
I get the following error:
Warning: bounding box given to google - spatial extent only approximate.
converting bounding box to center/zoom specification. (experimental)
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=-13.25,27.75&zoom=6&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=-13.25,27.75&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'
Tried this line, but didn't help:
options(download.file.method = "curl")
If I try osm - also problems:
osmmap <- get_openstreetmap(bbox = c(left = 21.5, bottom = -18.5, right =
34, top = 8), scale = 7, color = c("bw"))
Error: map grabbing failed - see details in ?get_openstreetmap.
In addition: There were 16 warnings (use warnings() to see them)
Any idea what to do?