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

Use MapboxOverlay for handling Maplibre interaction? #437

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kylebarron
Copy link
Member

@kylebarron kylebarron commented Mar 24, 2024

Change list

  • Import Maplibre CSS with import "maplibre-gl/dist/maplibre-gl.css";. This is required to show the attribution control. Fixes Import MapLibre CSS #436.
  • Use MapboxOverlay for 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):
image

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, Deck only receives a subset of user inputs delegated by Map. Therefore, certain interactive callbacks like onDrag, onInteractionStateChange are 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 position property in viewState has 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 MapboxOverlay you 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 Select by bounding box #417
  • Note that fly_to is now broken. This is because deck is no longer maintaining the view state itself.

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

Successfully merging this pull request may close these issues.

Import MapLibre CSS
1 participant