carbonplan / maps

interactive multi-dimensional data-driven web maps
https://maps.demo.carbonplan.org
Other
212 stars 18 forks source link

Integration with existing mapbox applications #102

Open lukecoursey opened 1 year ago

lukecoursey commented 1 year ago

Great work with this library, I think it's a pretty neat tool. From my understanding looking at the codebase, you've implemented your own mapbox components which wraps up the custom funcitonality, and it's reliant on mapbox gl v1. Correct me if i'm wrong but I suspect this eliminates the possiblity of ingegrating this with an existing mapbox application? (For example one built with react-map-gl). But I wanted to raise this as a use-case regardless. Would be fantastic if the library could expose a component that could be rendered as an overlay or as layers that sync with an existing mapbox map, in a similar way that deckgl library integrates with mapbox gl.

katamartin commented 10 months ago

👋 @lukecoursey, thanks for opening this issue (and apologies for the delay responding)! Your understanding is exactly right. This is something we've thought about before, but right now, the library depends on some fairly specific mapbox-gl-js v1 interfaces that hook into the map's rendering cycle [0].

In order to handle plugging in arbitrary map references from other applications, we would need to implement similar integrations for each additional supported application. We expect this work would be non-trivial and would require a major redesign of the library (e.g., removing the Map export?), so it's not currently on our development roadmap.

Hopefully this explanation helps to sketch out the work that a supporting a BYO-map integration would require. Happy to discuss the use-case in more detail if there's something I'm missing here!

[0] The Raster component only redraws the raster tile contents during the mapbox-gl-js map drawing cycle.