dkahle / dkahle/ggmap

Making `bbox` compatible with `sf::st_bbox`

Open
#367 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
778
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Would be nice to accept a bbox computed from `sf`
Example:

```r
get_stadiamap(st_bbox(sf_object), zoom = 13, maptype = "alidade_smooth") |> ggmap()
```

Currently we have:
```r
> bbox = c(xmin = 39.758428, ymin = -2.982270, xmax = 39.845852, ymax = -2.855576 )
> get_stadiamap(bbox, zoom = 13, maptype = "alidade_smooth") |> ggmap()
ℹ © Stadia Maps © Stamen Design © OpenMapTiles © OpenStreetMap contributors.
Error in get_stamen_url(maptype = maptype, zoom = zoom, x = row["x"], :
is.wholenumber(x) || !(0 <= x && x < 2^zoom) is not TRUE
```

I think we could simply remove the `if` statement:
https://github.com/dkahle/ggmap/blob/8b12bebcc95b6ed2fe211580a88f0b47922baf4b/R/get_stadiamap.R#L185

```{r}
names(bbox) <- c("left","bottom","right","top")
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.