-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adding/removing a GeoJSON source doesn't show in layer till map is zoomed in/out #6612
Comments
Might be the same issue as I had with iOS, see #6177 (comment) |
This sounds different than #6177. As of beta 3, we’re correctly invalidating the map when a layout or paint property or filter is set; however, swapping out a source is probably distinct from changing a filter. @jfirebaugh, does this sound like something that should’ve been fixed by #6201, or is it another special case? |
@cammace Just to clarify, this issue is not about updating a |
This is exposing some lax behavior in our runtime styling APIs -- it's not actually intended to be possible to remove a source that's currently in use by one or more layers, add another source with the same ID but different data, and have the layers update to the new data. (Doing so potentially violates numerous invariants that the style attempts to enforce.) Instead, removing an in-use source should either:
|
@jfirebaugh Agreed. I would prefer an error in this situation to make it abundantly clear that this is an unsupported operation. I removed this from the upcoming release milestone as it is not a blocker. |
It should be noted that the same behavior is seen if one changes the backing data in a geojson source
|
My current workaround is |
@jfirebaugh I'm using |
Ok, please open a fresh issue. |
@jfirebaugh done: #6744 |
I am also facing this issue with beta4. I call removeLayer(layerId) before adding a new layer (with different id). I recorded a short recording here (glitch happens at 11 seconds from start) |
@damianflannery Could you share some code (minimal case) so we can see how you're doing this? The original issue was about removing/adding a source to get layers updated, you seem to be doing something else. |
@ivovandongen Sure, I created a sample project here: I also created another recording of the issue using this sample and log output below (Nexus 5X, Adnroid 6.0.1):
Thanks for taking a look. |
@damianflannery Thanks for the example code. That cleared things up a lot. There is a slight issue in your code that triggers this behaviour. You add sources, but never remove them. The issues start appearing when a source is added twice for the same id it seems. If your remove your source, just as the layers. It works as expected. See this patch for details. If you want to get the most out of it in your real application btw, it might be worth toggling the opacity or visibility on layers instead of remove/adding them. This often gives a smoother transition. |
Ah, now works perfectly. Thank you @ivovandongen :) |
Platform: Nexus 5x running Nougat
Mapbox SDK version:
4.2.0-beta.3
Steps to trigger behavior
Expected behavior
Updated source shows up instantly when added to map
Actual behavior
new Source won't show up till after zooming map in or out (invalidating the map?)
cc: @ivovandongen @zugaldia
The text was updated successfully, but these errors were encountered: