ggmap
ggmap copied to clipboard
In get_googlemap, zoom argument overrides visible argument
In get_googlemap()
, using the visible
argument as a replacement for zoom
doesn't work, since zoom
is required to be numeric, the default is set to zoom = 10
, and zoom
is always pasted into the url. (The replacement of zoom with visible is discussed in this Google Maps Static Maps help article).
library(ggmap)
ggmap(get_googlemap(center = c(-75.90625, 37.9375),
maptype = "satellite", color = "color",
visible = data.frame(longitude = c(-75.93750,-75.87500),
latitude = c(37.95833,37.91667))))
This will use the default zoom = 10, not the smaller visible argument that is provided:
If the url is pasted into a browser and "zoom=10&" is deleted from the url, the updated map shows the desired extent.
The visible
argument allows more precise fine-tuning, and includes the attribution information (there is also the known issue of non-square sizes being improperly displayed, making the size
argument potentially problematic). Using the size
parameter to resize the extent removes much of the attribution, eg:
library(ggmap)
ggmap(get_googlemap(center = c(-75.90625, 37.9375),
maptype = "satellite", color = "color",
zoom = 13, size = c(450, 450)))