Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In get_googlemap, zoom argument overrides visible argument #330

Open
birdnirdfoley opened this issue Apr 25, 2022 · 0 comments
Open

In get_googlemap, zoom argument overrides visible argument #330

birdnirdfoley opened this issue Apr 25, 2022 · 0 comments

Comments

@birdnirdfoley
Copy link

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:
zoom10

If the url is pasted into a browser and "zoom=10&" is deleted from the url, the updated map shows the desired extent.
usingvisible

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)))

zoom13size450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant