Closed uitmaurik closed 6 years ago
Digging into the issue, I came at the point where CameraLogic.MoveToRegion
is creating a CoordinateBounds
object. When the center.Latitude > 90 or center.Latitude < 90, the created CoordinateBounds
object is not valid. I see no way to work around this when using the constructor with two CLLocationCoordinate2D
objects as this constructor does switch the positions itself. The only work around is to use the constructor that uses the VisibleRegion
object:
CoordinateBounds mapRegion = new CoordinateBounds(new VisibleRegion(
center.Latitude + halfLat,
center.Longitude + halfLong + (center.Longitude + halfLong > 180 ? -360 : 0),
center.Latitude + halfLat,
center.Longitude - halfLong + (center.Longitude - halfLong < -180 ? 360 : 0),
center.Latitude - halfLat,
center.Longitude + halfLong + (center.Longitude + halfLong > 180 ? -360 : 0),
center.Latitude - halfLat,
center.Longitude - halfLong + (center.Longitude - halfLong < -180 ? 360 : 0)
));
Thanks for your PR! I merged and released new lib. 🎉
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/3.0.4
VERSIONS
PLATFORMS
ACTUAL BEHAVIOR
When calling MoveToRegion with a longitude > 90 or < -90, the region is not set on iOS.
The latitude is valid when the value is between -90 and 90 and the longitude is valid when the value is between -180 and 180. Using a position somewhere in the pacific ocean will fail on iOS.
EXPECTED BEHAVIOR
For every possible Position, a call to MoveToRegion must set the appropriate region on the map.
HOW TO REPRODUCE
The following calls will succeed:
The following calls will fail: