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

getCameraForGeometry returns very wrong values when map is tilted #2789

Open
westnordost opened this issue Aug 31, 2024 · 0 comments
Open

getCameraForGeometry returns very wrong values when map is tilted #2789

westnordost opened this issue Aug 31, 2024 · 0 comments

Comments

@westnordost
Copy link
Collaborator

westnordost commented Aug 31, 2024

Describe the bug
getCameraForGeometry(Geometry geometry, int[] padding) should return the necessary camera zoom and position to enclose the given geometry on the current camera rotation and tilt.

This works fine for any rotation, but with tilt, this sometimes calculates a zoom much much lower than would be appropriate. The decisive factor for how wrong the calculation turns out to be seems to be the current camera position in relation to the position of the geometry. See the video:

Tilt.Zoom.Out.mp4

To Reproduce
Reproducable with https://github.com/streetcomplete/StreetComplete/releases/tag/v59.0-alpha2

A minimum test with which this should be reproducible is to have a GeoJson layer with one geometry that focuses the camera on tap without changing rotation or tilt. Then, tilt the map and select it like in the video.

Expected behavior
Correct calculation for getCameraForGeometry

Platform information:

  • Android, any version
  • Version 11.2.0

Additional context
Originally reported in streetcomplete/StreetComplete#5858

This is likely related to #2255, as surely the same algorithm is used to convert a lat-lon-pair to screen coordinates and back.

@westnordost westnordost added the bug Something isn't working label Aug 31, 2024
@westnordost westnordost changed the title getCameraForGeometry very wrong values when map is tilted getCameraForGeometry returns very wrong values when map is tilted Aug 31, 2024
@louwers louwers removed the bug Something isn't working label Nov 26, 2024
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

No branches or pull requests

2 participants