Annotations not stable or disappear after loop
Platform: Samsung Note 3 - Android Lollipop 5.0 Mapbox SDK version: 4.1.0-SNAPSHOT
Steps to trigger behavior
- After we rebuild last update the MapBox SDK 4.1.0-SNAPSHOT, then the problem is occur.
- Marker or annotation not stable, sometimes it show or hide from map.
Expected behavior
Actual behavior
@zhemora could you verify it's the 4.1.0-SNAPSHOT dependency?
The problem now is that there are multiple versions at this time:
- 4.0.1-SNAPSHOT
- 4.0.1
- 4.1.0-SNAPSHOT (this one hasn't been build for a couple of days)
And I need to be sure before looking into where the problem is originating from.
I just kicked of a build for the 4.1.0-SNAPSHOT so it reflects the latest state of master.
@tobrun i use 4.1.0-SNAPSHOT, previously not problem with 4.1.0-SNAPSHOT.

The problem is, when we create marker by looping the data position, and then we clear the map by "removeAnnotations()" and recreate marker again with the same data, we see the markers is gone.


Thanks for your help.
@zhemora To investigate this issue I created some sample code in 14e1207. The code adds/removes markers to/from a map constantly every 1500ms.

Could you share some code how you are adding/removing these markers? or compare it with 14e1207? Could you try testing with the newer SNAPSHOT? (for this you need to invalidate gradle caches and do a gradle sync)
@tobrun if we use default marker icon no problems occur, but if we use marker with custom icon and large (500) data position then the problem is occur (with newer SNAPSHOT). Thanks.
@zhemora thank you for adding that information. Will try to reproduce.
@tobrun fyi,
Platform: Samsung Note 3 - Android Lollipop 5.0 Mapbox SDK version: Newer Sync 4.1.0-SNAPSHOT

1) Sample code for adding/removing markers :

2) Showing the issue :

Thanks for your help.
@zhemora thank you for adding the code and GIF demonstrating the issue. Going to reproduce locally and debug why the markers aren't reloaded.
No problems doing a couple of iterations -> 2399 id marker

Next iteration I'm seeing some markers not being added to the map -> 2999 id latest maker

Next iteration, no markers shown -> 3599 id latest marker

@1ec5 are you seeing the same on iOS? Any idea what the cause of this could be?
@zhemora a workaround for now is to manage the markers yourself. So instead of adding/removing them constantly. I would suggest updating the position by calling setPosition by iterating over the newly received data and comparing this with the old data.
Your example matches those observations I have described in the comments of #4778. It happens only if you create new icons for every iteration from resources. I guess if you change your example to make use of an Icon that you always reuse this issue won't appear. However, for my use case i need to create new icons for every itereation as i need to change alpha and orientation (depending of the location of an off screen object).
Thank you @Schumi09 for that remark. It's starting to come back to me and I'm guessing this is related to the limitation of our sprite atlas being 1024x1024. More information about this issue can be found in https://github.com/mapbox/mapbox-gl-native/issues/3185. I'm going to do some tests around this to find the best way to handle this for now and will be closing this issue in favour of #3185. FWIW #3276 in combination with #4693 will make the use-case possible and will not limit us changing the marker.
I have a similar issue on 4.0.0, removeAnnotations doesn't remove any custom markers.
@afathman that issue should be fixed with 4.0.1
Ah, didn't notice the update. Thanks!
Thank you @Schumi09 for that remark. It's starting to come back to me and I'm guessing this is related to the limitation of our sprite atlas being 1024x1024. More information about this issue can be found in #3185. I'm going to do some tests around this to find the best way to handle this for now and will be closing this issue in favour of #3185. FWIW #3276 in combination with #4693 will make the use-case possible and will not limit us changing the marker.
So as the the current state for the 4.1.0 snapshot brought the nice MarkerViews I have replaced the Marker in my project that caused this issue for me with a MarkerView. After several minutes I can still see the MarkerViews. I guess it is save to confirm that your work has fixed this indeed :+1:
@Schumi09 thanks for validating, going to close this for now since we have the MarkerView workaround.
Can you please re-open this? Even though there is a workaround the intended/expected functionality does not work.
Our current testing shows that switching to MarkerViews is a valid workaround.
@Emeritus-DarranKelinske I would advice you to look into runtime styling. We are finalising this feature for the 4.2.0 release. These API supports the concept of SymbolLayer which is simaler to what Marker use in the low level API.