Bug 42151 - UWP Map VisibleRegion is calculated incorrectly
Summary: UWP Map VisibleRegion is calculated incorrectly
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.3.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 48375 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-24 14:49 UTC by Charles Petzold
Modified: 2017-07-14 09:13 UTC (History)
6 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Charles Petzold 2016-06-24 14:49:32 UTC
On the UWP and Windows Phone 8.1 platforms, the VisibleRegion property of the Map is being calculated incorrectly and results in latitude and longitude spans that are half the correct values.

The error is in https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Maps.UWP/MapRenderer.cs, lines 217 and 218. The current code is:

var latitudeDelta = Math.Abs(center.Latitude - boundingBox.NorthwestCorner.Latitude); 
var longitudeDelta = Math.Abs(center.Longitude - boundingBox.NorthwestCorner.Longitude); 

The correct code is:

var latitudeDelta = Math.Abs(boundingBox.SoutheastCorner.Latitude - boundingBox.NorthwestCorner.Latitude); 
var longitudeDelta = Math.Abs(boundingBox.SoutheastCorner.Longitude - boundingBox.NorthwestCorner.Longitude);

Alternatively, the current line 219

Element.VisibleRegion = new MapSpan(center, latitudeDelta, longitudeDelta);

can be changed to: 

Element.VisibleRegion = new MapSpan(center, 2* latitudeDelta, 2 * longitudeDelta);
Comment 1 Samantha Houts [MSFT] 2017-02-01 01:03:38 UTC
*** Bug 48375 has been marked as a duplicate of this bug. ***
Comment 2 Andreas 2017-02-14 20:19:37 UTC
So, confirmed and with a given fix for almost a year ago. Still not fixed...
Microsoft is really showing their last, valiant, UWP-developers respect. NOT.
Comment 3 Samantha Houts [MSFT] 2017-02-15 18:25:33 UTC
https://github.com/xamarin/Xamarin.Forms/pull/724
Comment 4 Rui Marinho 2017-03-07 10:48:19 UTC
Should be fixed on 2.3.5-pre1
Comment 5 Jacky Waswani 2017-07-14 09:13:12 UTC
Have verified the bug with latest forms build version 2.3.5.256-pre6.

Issue is seems to be fixed with latest build as well.

Now the fixed code is added in the forms samples & user is able to see the correct location on map.