-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Consecutive filter updates on heatmap layer #8268
Comments
|
Hi Vladimir. Thanks you so much for the answer, this is indeed a very interesting approach. We will definitely try this, noting that this requires stable geometries somehow (ie gridded data in our case). One comment: https://electricitytransition.com still has the same "delay" problem that I mentioned, which is barely visible at the framerate used on the live site (one frame every 100ms) but is very noticeable when setting a faster framerate (closer to 60 fps / 16ms frames).
Cheers |
Were you able to find a solution on how to cancel filter queue and skip to last item in queue? Any techniques learned on how to effectively animate using either setFilter or other techniques. |
Hi @agusterodin.
No, it's not possible. The way we (sort of) got around that limitation is to:
This was just released, currently writing a technical blogpost about it. |
(follow up of a conversation with @mikelmaron)
mapbox-gl-js version: 0.54
browser: Chrome and Firefox latest, macOS
Our current map is a combination of Mapbox GL layers for all non-animated layers, and a custom WebGL renderer for animated heatmaps, which is not performing well enough and is a battery drain (because it’s heavily CPU bound).
Steps to Trigger Behavior
See below
Link to Demonstration
On paper, using Mapbox GL heatmap layers would be an ideal solution: not only performance is much better, but also they look way better (and we could remove a huge legacy dependency from our front-end).
The problem is that we can't get this to behave nicely with animation (ie repeatedly changing a timestamp filter on a layer). See for yourself: https://codepen.io/nerik8000/pen/rgMdqP?editors=0010
Expected Behavior
When clicking the start button on the top left, the filter value gets updated at each rAF call to display more or less points depending on a timestamp global value.
When stopping the animation (stopping updates to filter), Mapbox GL should skip any pending update and display the filtered data that matches what the UI expects, which is the last timestamp.
Actual Behavior
As you can see in the demo, when clicking the stop button, there's seemingly a queue of rendering updates that get executed one by one. This result in a lag of several seconds between the expected value and what's actually visible in the map.
While I understand the performance implications of filtering that many points (several 10s of 1000s in the demo), there should be a mechanism to allow skipping frames to match as closely as possible whatever values are set from outside. The issue here being that the resulting discrepancy makes any numeric statement displayed outside the map wrong (until the animation's final frame).
Thanks for your help.
The text was updated successfully, but these errors were encountered: