visgl / deck.gl

WebGL2 powered visualization framework
https://deck.gl
MIT License
12.14k stars 2.08k forks source link

[Feat] MapboxLayer / MapboxOverlay integration with `globe` projection #7920

Open Beilinson opened 1 year ago

Beilinson commented 1 year ago

Target Use Case

In my organization we are required to use the Globe projection for our maps. Recently I stumbled upon the deck.gl library and would love to use it for the potential in additional 3D visualization it provides on top of mapbox.

However we quickly realized that although mapbox supports custom layers in globe view, the deck.gl layers don't update according to the projection which provides for some silly looking bugs like this one:

https://github.com/visgl/deck.gl/assets/54665621/b82f7be5-6273-43b2-ad0d-2cf997970243

We'd love to contribute to the deck.gl library and get this behavior fixed, where should we look to begin with?

Proposal

The mapbox globe projection is an adaptive projection which gradually morphs from the 3d globe to a 2d mercator projection between zoom levels 6-8. Seeing as these are arbitrary numbers which could be changed in the future, the MapboxLayer / MapboxOverlay integration should always update its projection matrix (and any other dependent properties) by the current zoom projection so that it stays accurate. All points without height should also clamp to the spheroid, while datasources with height should be offset from the spheroid rather than the 2d plane in mercator projection.

woozyking commented 1 year ago

This would be amazing to have!

chrisgervang commented 1 year ago

We have some related issues, like https://github.com/visgl/react-map-gl/issues/2091. We need mapbox to expose more of their camera parameters to pull this off. See more discussion in https://github.com/mapbox/mapbox-gl-js/issues/12040. In particular:

The only way I can make Mapbox integrations forward-compatible, by eliminating all hacks, is if transform can be consistently reproduced via public APIs.

Also, @Pessimistress accomplished this in maplibre with https://github.com/maplibre/maplibre-gl-js/pull/2535.. it'd be excellent if mapbox could implement this as well. It might not completely cover projections, but this is probably a pre-requisite...

TtangBro commented 1 year ago

Hello, can I learn the implementation code of the effect of your comment video

kubbo commented 1 year ago

Is the feature "MapboxLayer / MapboxOverlay integration with globe projection" planned for feture iterations ? When can we expect it to be implemented?

Pessimistress commented 1 year ago

Mapbox does not currently support custom layers in globe projection. We can't do anything until they expose sufficient API for us to implement integration.

Beilinson commented 1 year ago

If I'm not mistaken it seems that it does support custom layers for globe projection with parameters for both the mercator and globe + the transition between them:

https://github.com/mapbox/mapbox-gl-js/pull/12182

https://github.com/mapbox/mapbox-gl-js/pull/12544

What else is missing?