ggmap
ggmap copied to clipboard
get_map not returning satellite map when location specified as extents
I can get get_map to return a satellite map when specifying the maps location by a centroid i.e. location = c(Longitude, Latitude) , however, when I specify the location as a bounding box (i.e. location = c(left, bottom, right,top), it returns a terrain image not a satellite. In both examples I have specified maptype = "satellite". Is someone able to please shed some light on this issue?
It is not exactly clear to me, what you are trying to do and how you are doing it. Please note however that Google Map uses a center/zoom specification, which may be the reason why the satellite images are not shown when you specify a bbox.
If this does not solve your issue, yet, please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.
As I comment in my answer to this StackOverflow question, which essentially raises the same issue, there is some (to me) odd code in get_map()
that automatically and silently sets source to "stamen" and map_type
to "terrain" if the location is specified as a bounding box ...
PS this seems to be fixed in the development version: https://github.com/dkahle/ggmap/blob/master/R/get_map.R#L160-L164 . It was changed in https://github.com/dkahle/ggmap/commit/12d4678277994d8e548545a9a99e2cac99b58d15 (12 Feb 2019, just after the current CRAN version was released [5 Feb 2019])
@bbolker maybe I'm overlooking something simple, but installing the version from github (devtools::install_github("dkahle/ggmap")
) does not seem to fix the issue. I checked to make sure I'm installing from master, and that master has commit 12d4678 included.
So, like I said, unless I'm overlooking something, the dev version does not appear to fix this?
EDIT: Yes, I was overlooking something stupid. I forgot to reload the library after installing from github. Do'h! You appear to be correct that the error was added in 771a71b and fixed in 12d4678, but has not been updated on CRAN yet.
Anyone who stumbles across this in the future, you need to uninstall your ggmap from CRAN and install the ggmap from github:
remove.packages("ggmap")
devtools::install_github("dkahle/ggmap")
And remember to reload the library after you reinstall it!