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
Maplibre compatibility / transition #14
Comments
Most of the code I've encountered has been pretty intuitive but this part has been less so: placemark/app/lib/load_and_augment_style.ts Lines 28 to 44 in ff9723a
This is a bit off topic, but for one, this whole block is erroring a bit when I tried to upgrade to Mapbox v3.1 (see devtools screenshot). But more broadly, just curious about it. And I wonder if it'd be affected by a Maplibre switchover. I also tried briefly to excise DeckGL as you suggested above. It isn't a huge amount of code. But it seems like it might be helpful to time travel in commits back to your prior Mapbox GL only implementation if someone actually wanted to do this. I'm not sure I want to remove it yet, myself. |
Just a quick note and maybe off topic, since I did not look at the code, yet: I am using https://github.com/visgl/react-map-gl for all my React+Maplibre Projects and I am very happy with the way one can structure sources, layers and styles. This might be a good librate to transition to. I find it a lot easier to work with than plain Maplibre in React. |
Here are the two diffs from the commits that introduced Deck.gl: https://gist.github.com/tmcw/ab220612e3789ab9e776e0815654a170 - not sure if they'll reverse cleanly, but they should at least give an idea of the code before/after. So this code, which is creating the style, some notes off the top of my head: load_and_augment_style is there because Placemark supports multiple "base styles" but it needs to add additional style layers to represent both the "real" data layer as well as "ephemeral" layers, on top of the map. Doing these style modifications entirely through the Mapbox GL JS API turned out to be pretty complicated and error-prone - so instead this does the modifications to the style JSON, and sets the style in one pass, so we don't need to add/create layers via Mapbox GL. And, yeah, the layers themselves are fairly complicated - this is trying to optimize for performance as well as get good rendering so: There are two sources
ephemeral used to, as you can see in the diffs above, contain the vertexes and the lasso data, but those were both replaced by Deck.gl representations. Notes:
The issue that you're seeing… sometimes that crops in Placemark itself as a race condition between map handlers and the style updating - hovering over the map looks for a feature in a layer that doesn't exist yet - but maybe there's a change to GL 3.x that also changes how getting layers works? |
Not sure if this is helpful, but there is a whole different way of solving this problem: two Map-*-gl instances sharing the same screen real estate. The bottom one contains the main map data, the top one is just used for drawing. They are synchronised, obviously, when you drag and pan etc. |
Yeah, that's certainly an option - I can't give current estimates because I haven't tried it in a bit, but I think the perf was a bit slower with that approach. But open to whatever options, especially if folks are contributing PRs for them! |
Right now, Placemark uses a combination of Mapbox GL JS and Deck.gl. I think this could use some freshening-up:
The dream scenario would be implementing a diffing update pattern in Maplibre that was super efficient.
The text was updated successfully, but these errors were encountered: