You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
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
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.
Looking at the PressForMarkerActivity code it appears that the issue could be caused in either MapboxMap.OnMapLongClickListener().onMapLongClick() or MapboxMap.getProjection().toScreenLocation()
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.
Values Returned for Gare d'Echirolles
Gare d'Echirolles Location On Screen
Marker Set For Gare d'Echirolles. InfoWindow doesn't open either
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.
@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. 👍
Activity
bleege commentedon Jul 23, 2016
Was also able to recreate this on the
PressForMarkerActivityactivity this afternoon.bleege commentedon Jul 23, 2016
Specifically, when I long pressed on
Echirollesthe red default marker instead showed up nearVoreppe.bleege commentedon Jul 23, 2016
Looking at the
PressForMarkerActivitycode it appears that the issue could be caused in eitherMapboxMap.OnMapLongClickListener().onMapLongClick()orMapboxMap.getProjection().toScreenLocation()bleege commentedon Jul 23, 2016
Using the
Gare d'Echirollesas a base test I was able to confirm that theLatLngpassed intoonMapLongClick()was accurate at Lat = 45.15834327099316 and Lon = 5.713247070277475.Values Returned for Gare d'Echirolles
Gare d'Echirolles Location On Screen
Marker Set For Gare d'Echirolles. InfoWindow doesn't open either
bleege commentedon Jul 23, 2016
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 callsNativeMapView.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.bleege commentedon Jul 23, 2016
At first glance it doesn't look like the jni.cpp's nativeAddMarkers method has changed since 4.1.0 was released.
1ec5 commentedon Jul 23, 2016
Doesn’t reproduce in iOS SDK v3.3.1 or macOS SDK as of 4b1eead (master).
BharathMG commentedon Jul 23, 2016
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 .
[android] fixes mapbox#5762. Passing pixel points to native jni for g…
BharathMG commentedon Jul 23, 2016
@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
for these changes, #5104 . Submitted a PR #5776 Verified with the test app Location Picker activity.
tobrun commentedon Jul 24, 2016
@BharathMG thank you for contributing, first tests indicate that #5776 resolves the issue!
bleege commentedon Jul 24, 2016
@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
masterASAP. 👍