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

Should we expose a get_map_area() function? #5

Open
anthonynorth opened this issue Jul 4, 2020 · 2 comments
Open

Should we expose a get_map_area() function? #5

anthonynorth opened this issue Jul 4, 2020 · 2 comments

Comments

@anthonynorth
Copy link
Owner

I think we should also expose a get_map_area() function for making a Mercator rectangle with desired aspect ratio and buffer as well; this is useful for st_crop() other spatial data.

@elipousson
Copy link

I've put together a few function that serve a similar role for a Baltimore-specific mapping package I'm working on. The relevant functions include:

  • get_buffered_area: takes an sf object and applies a buffer based on distance in meters or a distance based on a proportion of the diagonal distance across the bounding box
  • get_asp_adjusted_bbox: take an sf object or bbox and returns a new bbox adjusted to contain the original bbox while matching a provided aspect ratio
  • get_adjusted_bbox: calls get_buffered_area and get_asp_adjusted_bbox and optionally switch CRS

If you had an idea about how you wanted to implement a get_map_area function for snapbox, I'd be happy to take your thoughts, adapt my code, and create a pull request. One small related suggestion: it would be nice if the area parameter for layer_snapbox supported sf objects and used a separate bbox parameter if a user wanted to set the map area with a bounding box.

@elipousson
Copy link

Whoops! I just realized that the functions you need to do this are already in the package just not documented and user accessible. You obviously don't need my code but I'm still happy to work on this if you have any suggestions.

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

2 participants