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

How to retain features outside of bbox after a projection? #672

Open
DigitalNaut opened this issue Feb 13, 2025 · 1 comment
Open

How to retain features outside of bbox after a projection? #672

DigitalNaut opened this issue Feb 13, 2025 · 1 comment

Comments

@DigitalNaut
Copy link

DigitalNaut commented Feb 13, 2025

Hey mbloch,

I'm working on an interactive learning app and I've encountered a tricky use case.

My app uses SVGs projected on a Leaflet map for various reasons.

I'm trying to reconcile features of my map data, namely Russia and Oceania, that have features spanning both sides of the image so I can have all the features visible in one area for the user. This forces me to transpose these features to the other side of the map, but they're left hanging off the standard frame. Unfortunately, when I project the map these features outside the limit are clipped entirely off the data.

I've tried rearranging my commands around this constraint, but Leaflet requires me to use pre-projected data that I can't generate after I've projected and transposed. This also leads me to a lot of big code duplication.

So I guess my question is two-fold:

  • Is there a way to preserve features outside the limits after a projection?
  • If that's not the case, is there a way to reproject the coordinates back to the original format?
@DigitalNaut
Copy link
Author

I guess I'm looking for a native solution since there's a great round utility function.

For anyone wondering, I decided to -require a custom function that uses the proj4 npm package to convert these values on demand. It's a bit verbose but gets the job done.

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