Discussion:
ggmap error??
Dave Askins
2018-09-25 12:28:12 UTC
Permalink
The same (I think) code that used to work fine now gives me an error.
map1 <- get_map(location = c(lon = -99.340360, lat = 30.058052), zoom =
"auto", scale = "auto", maptype ="watercolor", source = "stamen")

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

Question: I thought stamen was a different server from GoogleMaps. What
does this error cite googleapis??
Question: My understanding is that Google changed its access for geocoding
through its API and is now on a per-geocode basis. Is it possible that
get_map is also limited in a similar fashion.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Kahle
2018-09-25 13:48:40 UTC
Permalink
Hi Dave –

Asking for a Stamen map will query Google’s geocoding API if you give it a center/zoom specification.

Google’s servers are rejecting your request (403 error), probably because you’re not using an API key.

I recommend installing the dev version at

if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("dkahle/ggmap", ref = "tidyup")

Then look at ?ggmap::register_google(). AFAIK, Google’s static map service does not demand an API key, but I haven’t revisited that issue in some time.

More generally, the code in ggmap can return different results over time because the infrastructure on which it is built itself changes.

Hope that helps!
david.

===================================

David J. Kahle, Ph.D.
Associate Professor
Department of Statistical Science
Baylor University
www.kahle.io <https://www.kahle.io/>
Post by Dave Askins
The same (I think) code that used to work fine now gives me an error.
map1 <- get_map(location = c(lon = -99.340360, lat = 30.058052), zoom = "auto", scale = "auto", maptype ="watercolor", source = "stamen")
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=30.058052,-99.34036&zoom=10&size=640x640&scale=2&maptype=terrain&sensor=false'
cannot open: HTTP status was '403 Forbidden'
Question: I thought stamen was a different server from GoogleMaps. What does this error cite googleapis??
Question: My understanding is that Google changed its access for geocoding through its API and is now on a per-geocode basis. Is it possible that get_map is also limited in a similar fashion.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility <https://github.com/hadley/devtools/wiki/Reproducibility>
More options: http://groups.google.com/group/ggplot2 <http://groups.google.com/group/ggplot2>
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Richard Livornese
2018-11-15 22:30:34 UTC
Permalink
David,

I followed you suggestions(I think):

install.packages('digest')


if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("dkahle/ggmap", ref = "tidyup")

register_google(key = "myapikey")

us<-c(lon=-95.7129, lat=37.0902)
us_5<- get_map(location=us, zoom = 5, scale = 1)


and still get this error:


Source :
https://maps.googleapis.com/maps/api/staticmap?center=37.0902,-95.7129&zoom=5&size=640x640&scale=1&maptype=terrain&language=en-EN&key=xxx-PE8l_YV5466KpTeor6v8my6s
Error in get_googlemap(center = location, zoom = zoom, maptype = maptype,
:
Forbidden (HTTP 403).


If you have any other thoughts on other things to try, it would be great.

Thanks,

Rich
Post by Dave Askins
The same (I think) code that used to work fine now gives me an error.
map1 <- get_map(location = c(lon = -99.340360, lat = 30.058052), zoom =
"auto", scale = "auto", maptype ="watercolor", source = "stamen")
Error in download.file(url, destfile = tmp, quiet = !messaging, mode =
cannot open URL '
http://maps.googleapis.com/maps/api/staticmap?center=30.058052,-99.34036&zoom=10&size=640x640&scale=2&maptype=terrain&sensor=false
'
cannot open: HTTP status was '403 Forbidden'
Question: I thought stamen was a different server from GoogleMaps. What
does this error cite googleapis??
Question: My understanding is that Google changed its access for geocoding
through its API and is now on a per-geocode basis. Is it possible that
get_map is also limited in a similar fashion.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...