Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial MapController::updateCameraPosition uses wrong latitude #2249

Closed
westnordost opened this issue Mar 17, 2021 · 1 comment · Fixed by #2250
Closed

Initial MapController::updateCameraPosition uses wrong latitude #2249

westnordost opened this issue Mar 17, 2021 · 1 comment · Fixed by #2250
Assignees

Comments

@westnordost
Copy link
Contributor

westnordost commented Mar 17, 2021

REPRODUCTION

Attempt to set a position just after the map controller has been initialized. The latitude, and only the latitude will be off by some degrees. See this video:

Weird-Set-Lat-1.mp4

A few indicators:

  1. It is reproducible on tablets, the Android version or the manufacturer does not seem to matter. It is not always reproducible on first try, sometimes, it takes a few. On smartphones, noone was able to reproduce this issue so far.
  2. It is reproducible only if the latitude that should be set is above a certain magic number. The latitude will then always be set to exactly that magic latitude if it is greater than that number. The exact number seems to differ for different people (maybe related to screen dimension or ratio?)
    • For me (htc Nexus 9, Android 7) it was somewhere at latitude 51.32, as shown in the video
    • For @cyclingcat (Samsung Galaxy Tab A (2016), Android 8.1), it was latitude 45.653
  3. For the southern hemisphere, the issue is mirror-inverted: If I'd pan to latitude -80.0, this bug will let the view zoom to latitude -51.32 for my tablet

ENVIRONMENT:

  • Android, various versions
  • Tangram-ES 0.16.0. Reproducible with earlier versions

HOW I CAN BE SURE IT IS NOT A STREETCOMPLETE ISSUE?

Before line 171 of CameraManager.kt, I added the following code:

println("SET CAMERA POS TO ${_tangramCamera.latitude} + ${_tangramCamera.longitude}")

This is the only place in my app where MapController::updateCameraPosition is called.

The following and nothing else was logged while I created the above video:

SET CAMERA POS TO 57.05094124870993 + 9.921225851492574

In other words, the correct latitude is passed to Tangram-ES

@matteblair
Copy link
Member

As strange as this issue sounds, I actually have a hypothesis just from reading this description of the issue. I suspect that this is a consequence of some view logic we have that prevents the view from extending too far past the edge of the map projection.

This would explain why it only affects latitude (longitude wraps so we only apply this logic to latitude), why it is mirrored across the equator, and why the latitude depends on screen size. If I'm right, this should be an easy fix - probably just need to change the order of some operations.

Thanks for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants