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 has been archived by the owner on Aug 8, 2023. It is now read-only.
Platform: Android (possibly Core) Mapbox SDK version: All
Steps to trigger behavior
setLatLngBoundsForCameraTarget expects a LatLngBounds with coordinates in the [ne, sw] order. The expectation is that the eastern longitude value will be less than the western longitude value. This assumption, combined with wrapping all coordinates to be between 180 and -180 by calling unwrapForShortestPath, introduces ambiguity in how bounding boxes can be created. Consider this example:
One would expect a bounding box that covers most of the Earth's surface centered on the prime meridian with its east longitude at 170 and the west value at -170 but setLatLngBoundsForCameraTarget eventually results in a call to unwrapForShortestPath which converts these coordinates to 170 for the west longitude and 190 for the east longitude, resulting in a small bounding box spanning the antimeridian. See discussion starting here.
Add map.setLatLngBoundsForCameraTarget(LatLngBounds.from(20, 170.0 /*east*/, -20.0, -170.0 /*west*/)); to your map
View map and attempt to pan around
Expected behavior
Map should be centered on prime meridian and able to pan along the equator for most of the world's width
Actual behavior
Panning is fixed to a small box around the antimeridian.
Platform: Android (possibly Core)
Mapbox SDK version: All
Steps to trigger behavior
setLatLngBoundsForCameraTarget
expects aLatLngBounds
with coordinates in the[ne, sw]
order. The expectation is that the eastern longitude value will be less than the western longitude value. This assumption, combined with wrapping all coordinates to be between 180 and -180 by callingunwrapForShortestPath
, introduces ambiguity in how bounding boxes can be created. Consider this example:map.setLatLngBoundsForCameraTarget(LatLngBounds.from(20, 170.0 /*east*/, -20.0, -170.0 /*west*/));
One would expect a bounding box that covers most of the Earth's surface centered on the prime meridian with its east longitude at 170 and the west value at -170 but
setLatLngBoundsForCameraTarget
eventually results in a call tounwrapForShortestPath
which converts these coordinates to 170 for the west longitude and 190 for the east longitude, resulting in a small bounding box spanning the antimeridian. See discussion starting here.map.setLatLngBoundsForCameraTarget(LatLngBounds.from(20, 170.0 /*east*/, -20.0, -170.0 /*west*/));
to your mapExpected behavior
Map should be centered on prime meridian and able to pan along the equator for most of the world's width
Actual behavior
Panning is fixed to a small box around the antimeridian.
Related tickets:
#13006
#13087
cc @ansis @LukasPaczos
The text was updated successfully, but these errors were encountered: