Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Markers are not added at the correct location #5762

Closed

Description

@tobrun

Adding a gl marker to the map ontap/click just after starting up the map places a marker at the wrong location. See this example gif where it is first placed wrong and second attempt the behaviour is correct.

Note that this is a different issue as #5717.

ezgif com-video-to-gif 49

Activity

  1. added this to the android-v4.2.0 milestone on Jul 22, 2016
  2. added
    Android
    on Jul 22, 2016
  3. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    Was also able to recreate this on the PressForMarkerActivity activity this afternoon.

  4. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    Specifically, when I long pressed on Echirolles the red default marker instead showed up near Voreppe.

    2016-07-23 14_13_17

  5. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    Looking at the PressForMarkerActivity code it appears that the issue could be caused in either MapboxMap.OnMapLongClickListener().onMapLongClick() or MapboxMap.getProjection().toScreenLocation()

    screen shot 2016-07-23 at 2 33 22 pm

  6. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    Using the Gare d'Echirolles as a base test I was able to confirm that the LatLng passed into onMapLongClick() was accurate at Lat = 45.15834327099316 and Lon = 5.713247070277475.

    screen shot 2016-07-23 at 2 40 29 pm
    Values Returned for Gare d'Echirolles

    device-2016-07-23-143903
    Gare d'Echirolles Location On Screen

    device-2016-07-23-144602
    Marker Set For Gare d'Echirolles. InfoWindow doesn't open either

  7. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    Following the method flow the LatLng on the Marker / MarkerOptions is still correct all the way through the Java portion which ends at NativeMapView.addMarker() which calls NativeMapView.nativeAddMarkers() to pass the data into Core GL. The next action is to confirm that the JNI translation from Java to C++ is still good and if so then review the Core GL code. If it's a Core GL issue then this problem is likely to show up on the other @mapbox/mobile platforms too.

  8. bleege commented on Jul 23, 2016

    @bleege
    Contributor

    At first glance it doesn't look like the jni.cpp's nativeAddMarkers method has changed since 4.1.0 was released.

    screen shot 2016-07-23 at 3 07 54 pm

  9. 1ec5 commented on Jul 23, 2016

    @1ec5
    Contributor

    Doesn’t reproduce in iOS SDK v3.3.1 or macOS SDK as of 4b1eead (master).

  10. BharathMG commented on Jul 23, 2016

    @BharathMG
    Contributor

    I guess the PointF being passed to Core GL could be wrong. Will have to test to confirm. I'm debugging this issue now and found that sometimes I'm getting NaN LatLng values from onMapLongClick listener. And sometimes getting weird LatLng values while debugging at this method https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java#L927 .

  11. added a commit that references this issue on Jul 23, 2016
    e16c906
  12. BharathMG commented on Jul 23, 2016

    @BharathMG
    Contributor

    @bleege I guess here is an issue, https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java#L442 . Should be changed to

       `return nativeLatLngForPixel(mNativeMapViewPtr, pixel.x, pixel.y);
    

    for these changes, #5104 . Submitted a PR #5776 Verified with the test app Location Picker activity.

  13. tobrun commented on Jul 24, 2016

    @tobrun
    MemberAuthor

    @BharathMG thank you for contributing, first tests indicate that #5776 resolves the issue!

  14. bleege commented on Jul 24, 2016

    @bleege
    Contributor

    @BharathMG Thanks for tracking down the bug from #5104 and getting things back on track! Thanks also to @1ec5 for helping us narrow to focus to Android and @tobrun for getting this into master ASAP. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions