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

Helper for converting between Mercator and Euclidean coordinates #1165

Open
dabreegster opened this issue Mar 22, 2024 · 1 comment
Open

Comments

@dabreegster
Copy link
Contributor

I use something like https://github.com/dabreegster/ltn/blob/main/backend/src/common/mercator.rs in many of my projects that're focused on one roughly city-sized area at a time. Starting from WGS84 coordinates, I find the bounding box, use Haversine distance to find the width and length of the bbox, and then linearly interpolate to transform between the two coordinate systems.

Would something like this be useful in geo? There's some cleanup of the API to do, but before I make a clean PR, I wanted to see if something like this is appropriate/useful.

@kylebarron
Copy link
Member

Why not use spherical mercator? A la https://github.com/mapbox/sphericalmercator? You don't need a haversine distance to find the initial bounding box; you just project onto a normal grid. Supercluster has some simple functions for this:
https://github.com/mapbox/supercluster/blob/fff7326c0232c3d488afee93c93c6b8eac5bcb46/index.js#L407-L424

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