'Google API key error in ggmap even when specifying other source
I've started using the package ggmap after a while again, now I'm encountering a problem when I try to fetch a map using the function get_map. No matter which source I specify, I always get the error
Error: Google now requires an API key.
See ?register_google for details.
although I'm not sure why a call like
get_map(location = "texas", zoom = 6, source = "stamen")
Would need an API call to google. Has anyone experience something similar and is there a known workaround?
Solution 1:[1]
As @camille point out, this could be solve providing a bbox object which we can do with the package {osmdata}, function getbb()
In your case it would be:
pacman::p_load(ggmap, osmdata)
get_map(location = getbb("texas"), zoom = 6, source = "stamen")
Conclusion:
No need to create a google API key to retrieve a basemap from google map or openstreet maps. Hope it helps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Santiago Sotelo |
