2

After the Windows 10 Creators upgrade (build 15063), the MapControl children in my UWP app aren't fixed on the map anymore when moving or zooming the map itself. From a specific zoomlevel, I noticed a difference in behaviour when zooming on the map. From that point there is a visual 'globe' effect notable. Difficult to describe, but the map isn't pure flat (2D) in my opinion.

See here the desired output on build 14393, as you can see the radar overlay stays on the same position when moving or zooming the map: Image: https://www.regenthetin.nl/files/desired_behaviour_v14393.gif

Undesired output on build 15063, the overlay moves slowly with the map: Image: https://www.regenthetin.nl/files/undesired_behaviour_v15063.gif

Responsible code blocks:

Snippet 1

// Add children to MapControl at specified location
var radarImgPosition = new Geopoint(new BasicGeoposition()
{
    Latitude = 59.60,
    Longitude = -12.00
});

RadarMap.Children.Clear();
if (RadarMap.Children.Count == 0)
{
    RadarMap.Children.Add(radarImg);
    MapControl.SetLocation(radarImg, radarImgPosition);
}

Snippet 2

private void RadarMap_ZoomLevelChanged(MapControl sender, object args)
{
    Windows.Foundation.Point southWestPoint;
    RadarMap.GetOffsetFromLocation(new Geopoint(new BasicGeoposition()
    {
        Longitude = -11.9687,
        Latitude = 46.9106
    }), out southWestPoint);

    Windows.Foundation.Point northEastPoint;
    RadarMap.GetOffsetFromLocation(new Geopoint(new BasicGeoposition()
    {
        Longitude = 15.5080,
        Latitude = 60.0247
    }), out northEastPoint);

    double radarImgWidth = northEastPoint.X - southWestPoint.X;
    double radarImgHeight = Math.Abs(northEastPoint.Y - southWestPoint.Y);

    DisplayInformation displayInformation = DisplayInformation.GetForCurrentView();
    double scaleValue = (displayInformation.RawPixelsPerViewPixel * 100.0);

    radarImg.Height = (radarImgHeight) / (scaleValue / 100);
    radarImg.Width = (radarImgWidth) / (scaleValue / 100);
}

I've investigated in it for several hours, but I didn't find a solution so far. I hope someone can help me!

Dev config: Visual Studio 2017 i.c.m. Windows 10 Creators update SDK.

Liero
  • 25,216
  • 29
  • 151
  • 297
Wietse-0803
  • 125
  • 1
  • 4
  • What is the target SDK in your project? – Stefano Balzarotti Apr 07 '17 at 13:56
  • Hi Stefano, I changed the target to the newest build (15063). But the behaviour of the MapControl is the same when targeting a lower version. It's very annoying, if no solution is available I will switch to Google Maps and embed it in a browser element. Disappointing, but the only way to guarantee the same user experience. Do you have other suggestions? – Wietse-0803 Apr 07 '17 at 14:01
  • this is a bug, because if you target the old SDK, the behavior should not change. You should report this bug to Microsoft. – Stefano Balzarotti Apr 07 '17 at 14:29
  • I also posted this issue on MSDN fora [link](https://social.msdn.microsoft.com/Forums/windowsapps/en-US/ab97e870-346c-4e82-8966-4f0c1b952338/uwpc-mapcontrol-children-not-fixed-positioned-anymore-after-w10-creators-update?forum=wpdevelop) and made a repro project of the issue [link](https://www.webenrichment.nl/files/MapControlBugRepro.zip). – Wietse-0803 Apr 07 '17 at 16:25
  • I can confirm that the decribed behavior also occurs after the Creators Update on Windows Mobile. – gomi42 May 04 '17 at 17:31

1 Answers1

1

I found the solution for my problem and I have the feeling yours is related. Background: My MapControl has a XAML element as child and I set and change the position while the element is visible. This child showed the same effect that the thread opener already described.

It turned out that the new MapControl (of the creators update) also takes the altitude into account when positioning the child. In other words now a XAML child is positioned in space and not on a the flap map. My guess is this the outcome off the new pseudo 3D effect of the MapControl.

The solution is to position the child onto the surface by specifing the terrain reference system and setting the altitude to 0:

        var location = new Geopoint(new BasicGeoposition
             {
               Latitude = currentLatitude,
               Longitude = currentLongitude,
               Altitude = 0 
             },
             AltitudeReferenceSystem.Terrain);
        MapControl.SetLocation(myChild, location);
gomi42
  • 2,449
  • 1
  • 14
  • 9