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.

Location mark (not drawn) disappears when view crosses international date line. #3995

Closed

Description

@manimaul

Given the view crosses the international date line (180 degrees E)
Given the center of the screen is right/east of the dateline
When the user location is east of the dateline
Then the user location should be drawn (but is not drawn)

See below screenshots where the location is: 16.85 S , 179.89 W
device-2016-02-17-162405
device-2016-02-17-162442

Activity

  1. added
    Android
    on Feb 18, 2016
  2. tobrun commented on Feb 18, 2016

    @tobrun
    Member

    @manimaul thank you for reporting this edge-case, this is great information to have.

  3. friedbunny commented on Feb 18, 2016

    @friedbunny
    Contributor

    edge-case

    There's no edge like the dateline edge. 🤔

  4. manimaul commented on Feb 20, 2016

    @manimaul
    Author

    @tobrun yes, dealing with the dateline is always fun. I'm wondering if you're willing to escalate this issue as it is a blocker for me. I have a large audience in New Zealand who use my app (MX Mariner) on the water, near the dateline. I'm currently using the previously deprecated Mapbox SDK and this is the remaining issue before making the switch to Mapbox GL. Thank you,
    Will

  5. mb12 commented on Feb 21, 2016

    @mb12

    @manimaul I would recommend looking at the following known issues for Android before switching over to new SDK. Your application will stop working on certain devices (where it previously worked including older Google Galaxy Nexus).

    #2980
    #4037
    #3693
    #1702

  6. manimaul commented on Feb 22, 2016

    @manimaul
    Author

    @mb12 thanks, I'll definitely keep an eye on those issues before making the leap.

  7. added this to the android-v4.0.0 milestone on Feb 24, 2016
  8. tobrun commented on Feb 25, 2016

    @tobrun
    Member

    @manimaul I added this issue to the higher priority list of bugs to solve. Sorry for not being able to give you a concrete ETA. It is not the only issue on that list. For now I'm doing some small tests around this issue to identify the source and determine the amount of work needed to get a fix in.

  9. tobrun commented on Feb 25, 2016

    @tobrun
    Member

    @manimaul could you give me some more information how you are setting this test up?
    All the mock GPS apps I have tested, don't work with this dateline issue.
    Example of this here, where you can see it's going the opposite direction.

  10. manimaul commented on Feb 26, 2016

    @manimaul
    Author

    @tobrun I'm using the Genymotion Android emulator which makes it easy to set the device's location.

    other options:

    1. Use the standard Android emulator and send a mock "geo" command via adb described here: http://developer.android.com/guide/topics/location/strategies.html
    2. Use the "new" beta Android emulator which has a GUI similar to Genymotion for setting the mock location. http://tools.android.com/tech-docs/emulator
  11. tobrun commented on Mar 1, 2016

    @tobrun
    Member

    @manimaul
    thank you for adding that information. I was tackling this issue from the perspective of having a route/gps trace. Looking into manually setting the location reveals the following:

    screen shot 2016-03-01 at 11 02 17

    if you pan the map a bit to the right, the UserLocationView disappears:

    screen shot 2016-03-01 at 11 02 25

    The source of that issue will be the solution to what is mentioned above.

  12. tobrun commented on Mar 1, 2016

    @tobrun
    Member

    I was able to pinpoint this to toScreenLocation method returning the wrong values when crossing the dateline. This toScreenLocation is used in the following method:

        public PointF getMarkerScreenPoint() {
            if (mMyLocationTrackingMode == MyLocationTracking.TRACKING_NONE) {
                mMarkerScreenPoint = mProjection.toScreenLocation(mMarkerCoordinate);
            } else {
                // tracking the user
            }
            return mMarkerScreenPoint;
        }

    This method is being called on every update call, to get the correct x,y coordinates for the UserLocationView. Currently not the correct values are returned.

    For example:
    before crossing the dateline:

    MarkerScreenPoint 455.80133:746.6456

    after

    MarkerScreenPoint 393667.44:747.1837

  13. tobrun commented on Mar 1, 2016

    @tobrun
    Member

    Been trying to locate this problem in C++.

    It is going through map.cpp, transform.cpp and transform_state.cpp.

    In transform_state.cpp it is using the following method:

    PrecisionPoint TransformState::latLngToPoint(const LatLng& latLng) const {
        return coordinateToPoint(latLngToCoordinate(latLng));
    }

    which on his turn calls coordinateToPoint and latLngToCoordinate:

    PrecisionPoint TransformState::coordinateToPoint(const TileCoordinate& coord) const {
        mat4 mat = coordinatePointMatrix(coord.zoom);
        matrix::vec4 p;
        matrix::vec4 c = {{ coord.column, coord.row, 0, 1 }};
        matrix::transformMat4(p, c, mat);
        return { p[0] / p[3], height - p[1] / p[3] };
    }
    TileCoordinate TransformState::latLngToCoordinate(const LatLng& latLng) const {
        const double tileZoom = getZoom();
        const double k = zoomScale(tileZoom) / worldSize();
        return {
            lngX(latLng.longitude) * k,
            latY(latLng.latitude) * k,
            tileZoom
        };
    }
  14. tobrun commented on Mar 1, 2016

    @tobrun
    Member

    I made a follow up issue #4155, since this problem is found in mbgl instead of Android SDK.

  15. tobrun commented on Mar 6, 2016

    @tobrun
    Member

    I'm closing this issue in favour of #4155

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