lonboard
lonboard copied to clipboard
Use `MapboxOverlay` for handling Maplibre interaction?
Change list
- Import Maplibre CSS with
import "maplibre-gl/dist/maplibre-gl.css";. This is required to show the attribution control. Fixes https://github.com/developmentseed/lonboard/issues/436. - Use
MapboxOverlayfor synchronizing Deck and Maplibre.
With these changes, it looks much more like a mapbox/maplibre map the user might be familiar with (note the ScaleControl, NavigationControl, FullscreenControl and AttributionControl):
There's a wider question here: should Maplibre be a child of Deck or should Deck be a child of Maplibre? The Deck docs list some limitations:
- When using deck.gl's multi-view system, only one of the views can match the base map and receive interaction. See using MapboxOverlay with multi-views for details.
- When using deck.gl as Mapbox layers or controls,
Deckonly receives a subset of user inputs delegated byMap. Therefore, certain interactive callbacks likeonDrag,onInteractionStateChangeare not available.- Mapbox/Maplibre's terrain features are partially supported. When a terrain is used, the camera of deck.gl and the base map should synchronize, however the deck.gl data with z=0 are rendered at the sea level and not aligned with the terrain surface.
- Only Mercator projection is supported. Mapbox adaptive projection is not supported as their API doesn't expose the projection used.
- The
positionproperty inviewStatehas no equivalent in mapbox-gl.
Maplibre as a child of Deck (not using MapboxOverlay)
- We should be able to have more low level control over visualization and be less tied to maplibre.
- For example, it would be really cool to visualize a side-by-side map, where you could swipe to see a before-and-after with two datasets. This option is required for this feature. Otherwise, when using
MapboxOverlayyou can't have multiple interactive deck views. - This also would keep us less tied to geospatial. So in theory non-geospatial users could use lonboard without a basemap, and still get to use all of lonboard's utilities for data serialization.
Deck as a child of Maplibre (using MapboxOverlay)
- Can use all Maplibre and Maplibre-compatible controls. In theory this should even include things like mapbox-gl-draw. (Upstream example). In theory we wouldn't have to write our own, like we're doing in #417
- Note that
fly_tois now broken. This is because deck is no longer maintaining the view state itself.