ggmap: gives error when using open street map as source [closed]
Asked Answered
M

1

7

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.

Mukerji answered 9/5, 2014 at 20:0 Comment(2)
works for me. Maybe the API was down...Trapezoid
Voting to close because access to the Google Maps API has changed as of July 2018. An API key is now required to make a Google Maps request, so this question is no longer reproducible in it's current form.Shrug
H
1

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")
Hibernate answered 18/7, 2014 at 16:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.