mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Annotations not stable or disappear after loop

Open ghost opened this issue 10 years ago • 19 comments

Platform: Samsung Note 3 - Android Lollipop 5.0 Mapbox SDK version: 4.1.0-SNAPSHOT

Steps to trigger behavior

  1. After we rebuild last update the MapBox SDK 4.1.0-SNAPSHOT, then the problem is occur.
  2. Marker or annotation not stable, sometimes it show or hide from map.

Expected behavior

Actual behavior

ghost avatar May 13 '16 01:05 ghost

@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 avatar May 13 '16 06:05 tobrun

@tobrun i use 4.1.0-SNAPSHOT, previously not problem with 4.1.0-SNAPSHOT.

image

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.

image

image

Thanks for your help.

ghost avatar May 13 '16 07:05 ghost

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

ezgif com-video-to-gif 11

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 avatar May 13 '16 09:05 tobrun

@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.

ghost avatar May 13 '16 09:05 ghost

@zhemora thank you for adding that information. Will try to reproduce.

tobrun avatar May 13 '16 13:05 tobrun

@tobrun fyi,

Platform: Samsung Note 3 - Android Lollipop 5.0 Mapbox SDK version: Newer Sync 4.1.0-SNAPSHOT

image

1) Sample code for adding/removing markers :

image

2) Showing the issue :

2016_05_13_22_11_25_1463152442350_videotoimagegif

Thanks for your help.

ghost avatar May 13 '16 15:05 ghost

@zhemora thank you for adding the code and GIF demonstrating the issue. Going to reproduce locally and debug why the markers aren't reloaded.

tobrun avatar May 17 '16 08:05 tobrun

No problems doing a couple of iterations -> 2399 id marker device-2016-05-17-110341

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

device-2016-05-17-110552

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

device-2016-05-17-110749

@1ec5 are you seeing the same on iOS? Any idea what the cause of this could be?

tobrun avatar May 17 '16 09:05 tobrun

@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.

tobrun avatar May 17 '16 09:05 tobrun

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).

Schumi09 avatar May 17 '16 11:05 Schumi09

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.

tobrun avatar May 17 '16 14:05 tobrun

I have a similar issue on 4.0.0, removeAnnotations doesn't remove any custom markers.

afathman avatar May 17 '16 16:05 afathman

@afathman that issue should be fixed with 4.0.1

tobrun avatar May 17 '16 16:05 tobrun

Ah, didn't notice the update. Thanks!

afathman avatar May 17 '16 16:05 afathman

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 avatar Jun 06 '16 11:06 Schumi09

@Schumi09 thanks for validating, going to close this for now since we have the MarkerView workaround.

tobrun avatar Jun 06 '16 11:06 tobrun

Can you please re-open this? Even though there is a workaround the intended/expected functionality does not work.

Emeritus-DarranKelinske avatar Nov 25 '16 17:11 Emeritus-DarranKelinske

Our current testing shows that switching to MarkerViews is a valid workaround.

dazza5000 avatar Nov 26 '16 13:11 dazza5000

@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.

tobrun avatar Nov 26 '16 18:11 tobrun