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

Making bbox compatible with sf::st_bbox #367

Open
Rafnuss opened this issue Jan 3, 2025 · 0 comments
Open

Making bbox compatible with sf::st_bbox #367

Rafnuss opened this issue Jan 3, 2025 · 0 comments

Comments

@Rafnuss
Copy link

Rafnuss commented Jan 3, 2025

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

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

Currently we have:

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

if(is.null(names(bbox))) names(bbox) <- c("left","bottom","right","top")

names(bbox) <- c("left","bottom","right","top")
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