I'm new to R and I'm following this article to learn ggmap.
qmap("Forbidden city",zoom=15)
qmap("Forbidden city",zoom=15, source="osm")
While the first command above works perfectly, the second one gives me an error info:
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Forbidden+city& zoom=15&size=%20640x640&maptype=terrain&sensor=false Google Maps API Terms of Service : http://developers.google.com/maps/terms Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Forbidden+city&sensor=false Google Maps API Terms of Service : http://developers.google.com/maps/terms Error: map grabbing failed - see details in ?get_openstreetmap. In addition: Warning message: In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : cannot open: HTTP status was '503 Service Unavailable'
Any help is appreciated.
I get the same error, reproducibly.
I think this is to do with the zoom=...
specification. This argument is interprested differently depending on the source
. When you specify source="osm"
the call is routed to get_openstreetmap(...)
. According to the documentation for that function:
...if you get an error when downloading an openstreetmap the error is attributable to an improper scale specification...
The zoom
parameter influences the scale specification if scale="auto"
(the default). So basically, if zoom
is too large the call will throw an error. I get errors with zoom > 13 for the Forbidden City, but this works:
qmap("Forbidden city",zoom=13, source="osm")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With