Bug 60812 - Maps precision is too large
Summary: Maps precision is too large
Status: NEEDINFO
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-22 14:22 UTC by Sylvain Gravel
Modified: 2017-12-11 00:17 UTC (History)
2 users (show)

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


Attachments
Result at Zoom Scale 2 (55.28 KB, image/png)
2017-11-22 14:22 UTC, Sylvain Gravel
Details
Result at zoom scale 1 (46.51 KB, image/png)
2017-11-22 14:23 UTC, Sylvain Gravel
Details


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 for Bug 60812 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEEDINFO

Description Sylvain Gravel 2017-11-22 14:22:45 UTC
Created attachment 25799 [details]
Result at Zoom Scale 2

I'm working on a cross platform maps overlay Nuget for Xamarin.Forms.Maps.  I'm encountering a precision issue with MapSpan.

On certain iOS devices (iPads mostly), the OS allows to zoom to a Scale of 2.  Under these circumstances, a tile is 128x128 virtual pixels has a latitude span of 7.40434459345352E-06 near the poles (> ~85 degrees).  This value is smaller than the MapSpan.MinimumRangeDegrees (which is 8.99321605918731E-06) so initializing a MapSpan for such a small area, as required for that zoom level, clamps the LatitudeDegrees and creates imprecision that is visible when drawing.

We would need to lower the minimum range degrees to support these zoom levels.
Comment 1 Sylvain Gravel 2017-11-22 14:23:14 UTC
Created attachment 25800 [details]
Result at zoom scale 1
Comment 2 Sylvain Gravel 2017-11-22 14:27:44 UTC
Output calculations.  Tile coordinates are Mercator coordinates, computed GPS coordinates are under.

[0:] Large bounds for tile {X=0 Y=0 Width=256 Height=256}
(-179.999656677246, 85.051099162384; 
-180, 85.0511287798066)

[0:] Small bounds for tile {X=0 Y=0 Width=128 Height=128}
(-179.999828338623, 85.0511123822459; 
-180, 85.0511303686781)

Mercator GPS coordiante for latitude Y = 0 (Top of map) should be 85.0511287798066
With the smaller tiles, we end up with 85.0511303686781, which is the center point of the tile + MinimumRangeDegrees (8.99321605918731E-06)
Comment 3 Sylvain Gravel 2017-11-22 14:29:59 UTC
One final note about the screenshot, the two orange lines meet at the 180th meridian at the very top of the map (X = 0, Y = 0) and (X = 0, Y = 268435456)
Comment 4 Sylvain Gravel 2017-11-22 14:30:42 UTC
Argh sorry, that last coordinates should have been (X = 268435456, Y = 0)
Comment 5 Paul DiPietro [MSFT] 2017-12-10 22:43:46 UTC
Can you elaborate on which iOS devices and versions this occurs on, and more specifically if certain iPads work, and others don't? A minimized reproduction we can look at is helpful as well. We have recently shifted to using GitHub issues so it may be beneficial to file an issue there instead as this is a more recent report.
Comment 6 Sylvain Gravel 2017-12-11 00:17:01 UTC
This was on iPad Air and most likely I tested on another iPad through the emulator but I don't have a list around.  My assumption was that the iPad's larger screen allowed for one extra level of zoom.  Maybe that the max level of zoom is controlled based on the device or map control frame, I haven't tested.  

The project on which this occurs is available at https://github.com/LRP-sgravel/FormsSkiaBikeTracker/commits/dev but be aware that I worked around the issue by creating my own MapSpan class.