Feature/mvt integration#46
Feature/mvt integration#46rkreienbuehl wants to merge 54 commits intop-lr:feature/mvt-integrationfrom
Conversation
add ViewportInfo fix broken test
… addVectorTileStreamProvider
add ViewportInfo fix broken test
|
@p-lr I improved the performance quite a bit with some LruCaches. It is still not perfect, but I noticed a big difference (when testing with Symbol markers commented out). Displaying symbols as markers is not ideal, maybe drawing them in a separate layer would improve performance. |
|
I will have a look this weekend. If I remember correctly, markers are used for symbol rendering because symbols can span across tiles, and markers is currently the only way to position some "view" at a known position. However it requires careful management because too many markers can impact performance. |
|
That's what I thought, but I didn't had the time to look more into it. Curious to hear from you. |
|
In addition, when you rotate the map, symbols like place or street names must remain straight. So you see that they are handled as markers. Only we need to figure out a way to do it efficiently. |
|
Thats true. I am on it to bring symbols into a separate layer, so no markers need to be added. It works on desktop, on iOS there is a problem, will work on it more in the evening and push it as soon as there is a first milestone on it. |
|
I guess the symbols layer mostly replicates how the marker layout works. But yes, it's a good idea to have a core concept dedicated to symbols, instead on building around the markers api. |
|
Yes, instead of render() on a symbol, i implemented a draw() method that takes the drawScope and the draws on it mostly the same way how render() worked. |
|
Symbol painting is now in a separate layer. This works, but it is not tested into detail. |
|
Alternatively, we can merge your MR right now, so I can contribute on |
|
I just added you as collaborator.
Thats correct. I didn't do any cleanup so far and left the |
…needed by vector layer
|
I've removed the former demo, and refactored core classes like MapState and TileCanvasState. My next focus will be the high level architecture of |
|
Yeah, I noticed the same. At the moment every symbol is drawn. I will research how maplibre handles symbols and implement such a behavior to address issue 1. |
|
I will let you know when I'm done with the refactor. I'll see if I can also tackle issue 2 at the same time. |
|
Sounds good to me. I'll find out more about collision detection and involved algorithms in the meantime. |
|
I've partially improved issue 2, or at least enough for the moment. Two major changes:
viewportInfoFlow
.throttle(250)
.collectLatest { viewportInfo ->
...
}
I believe this is enough for issue 2 (for now). You can focus on issue 1. |
|
I made some research. What I found out so far: To come closer to how maplibre does symbol placement, symbols should be preproduced so I will implement a placement engine. This would improve performance, because symbols aren't produced every time the viewport changes. Also with the current implementation of symbols only the priority is used for determining the order of placing them, maplibre also uses the layer as info for this. Will take some time to implement this properly. Will get back as soon as there is an update on it. |
|
Having a
On top of my head, the engine should make this distinction. Like, when the tile set changes, that means new tiles are visible (or a completely different list of tiles). This is different from when the visible area changes (alone), as in this case it means the user has zoomed in or out but the tiles set is still the same. In that case, the internal list of symbols remains the same, only the scale changes and the engine should probably run collision detection on all the markers in cache to determine the new list of visible symbols. To summarize, the engine would maintain an in-memory cache of produced symbols, and that cache would be updated whenever the tile set changes. Maybe that cache would look like a What do you think? |
|
I totally agree. This approach would also be very close to what maplibre does with symbols. I didn't had the time to come up with a full concept, but will work on it this week as much as I find time, so we can discuss this in detail. |
|
Sounds good, no hurry. |


@p-lr here the new MR draft of my work.
Rasterizer is still very slow on all devices (desktop seemed fast at first, but depends on the hardware), performance needs to be drastically improved, maybe you have some ideas what could bring better performance? One idea is to draw the symbols instead of using markers, but rendering itself also needs to be improved. I will investigate this further. Maybe you also have some inputs on how to improve performance?
I could fix the crashes on iOS and Android, so the demo works on iOS, Android and desktop
Collision detection is not integrated right now
I am in holidays from next week, but will work on it as I find the time.