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

Feature Request: Mutable Map Projections #80

Open
Dunrar opened this issue Jul 8, 2024 · 5 comments
Open

Feature Request: Mutable Map Projections #80

Dunrar opened this issue Jul 8, 2024 · 5 comments

Comments

@Dunrar
Copy link

Dunrar commented Jul 8, 2024

Hi, very cool project! Would it be possible to implement dynamic/mutable map projections for feature layers?

Use cases include:

  • Dynamic change of projection parameters (e.g. rotation)
  • Dynamic transitioning between different projections

Some examples of other tools that allow similar things:

@Maximkaaa
Copy link
Owner

This is definitely something Galileo has to know how to do. But I'm not sure how useful just having setter on the CRS field in FeatuerLayer would be. This is because with current approach all the caches would have to be dropped in a CRS changes, which is basically same as creating a new FeatureLayer with old one's data and new CRS. And this would work the same way as mapbox does. I would really like Galileo to look more like Bernies demo, with smooth transitions between projections. (Not sure how to implement it though...)

Having said that, I would accept a PR that makes crs field settable in the FeatureLayer for now.

@Dunrar
Copy link
Author

Dunrar commented Jul 9, 2024

Great to hear that you think this is in the scope of Galileo!

Wouldn't we need to set the crs field of the MapView, though?

@Maximkaaa
Copy link
Owner

Yes, you are right. crs in the FeatureLayer specifies the CRS of the input data, crs in the MapView is the displayed one. But then, changing it requires resetting all layer's caches... And thinking about that, currently tile layers do not know how to reproject data, if I remember correctly. So if we implement this, currently it would work only for feature layers.

@Dunrar
Copy link
Author

Dunrar commented Jul 16, 2024

In the lambert.rs demo I tried to simply set the Crs of the Map (or rather its MapView) in the .with_event_handler() closure. This does work in some ways, hovering now highlights the countries as if the map were already re-projected. The change does not propagate to the actual render though, even after calling map.redraw(). Before I look into this any further, do you have an idea why this might be the case? Thanks!

@Maximkaaa
Copy link
Owner

This is because FeatureLayer caches the result of projection/rendering operation, but it does not detect that the CRS has changes and does not invalidate the cache.

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