I have been using the R package ggmap version 3.0.0 to download and plot google images in R. Recently I have discovered an issue when the map is not square. It seems that the size argument is not working properly. Note that when the same URL is pasted directly into a web browser, the correct image is displayed. So likely the issue is within the ggmap() function.
This issue has been mentioned before. See here. Has anyone else had this issue and found a way around it? I used this same code in August 2019 with no issues.
library(ggmap)
register_google(key = "my_key")
map_sac <-get_googlemap(center=c(-121.57,38.51), size=c(250, 500), zoom = 12, scale=2, maptype = "satellite")
ggmap(map_sac)
When plotting the image using ggmap(), the image appears twice. But notice the lat/lon are correct as if the map were only plotted once.
When downloading a square image, get_googlemap() and ggmap() work correctly.
map_sac2 <-get_googlemap(center=c(-121.57,38.51), size=c(500, 500), zoom = 12, scale=2, maptype = "satellite")
ggmap(map_sac2)
One more example. If I change the size dimensions to c(500,100), I generate five images side by side. It seems that the size component (scale) is somehow being multiplied into the plotting feature.
map_sac3 <-get_googlemap(center=c(-121.57,38.51), size=c(100, 500), zoom = 12, scale=2, maptype = "satellite")
ggmap(map_sac3)