In get_googlemap, zoom argument overrides visible argument
- Dominant language
- R
- Stars
- 778
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
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](https://developers.google.com/maps/documentation/maps-static/start#Viewports)).
```r
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](https://github.com/dkahle/ggmap/issues/17), making the `size` argument potentially problematic). Using the `size` parameter to resize the extent removes much of the attribution, eg:
```r
library(ggmap)
ggmap(get_googlemap(center = c(-75.90625, 37.9375),
maptype = "satellite", color = "color",
zoom = 13, size = c(450, 450)))
```

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.