1

I'm trying to use the MapControl control in a UWP App.

I've followed this tutorial: https://msdn.microsoft.com/en-us/windows/uwp/maps-and-location/display-maps#mapconfig

But my map shows an empty blue map:

enter image description here

This is the XAML Code:

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Maps:MapControl
       x:Name="MapControl1"            
       ZoomInteractionMode="GestureAndControl"
       TiltInteractionMode="GestureAndControl"   
       MapServiceToken="bSRPuDBxuLhlpg8bpeWO~wEhCZkvxi-GBzWNNSUH1bA~ApmPFjGTrAZSSS6M6SdEa5lA...moremoremore..."/>
    </Grid>

This is the .cs Code:

protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Specify a known location.
            BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 47.604, Longitude = -122.329 };
            Geopoint cityCenter = new Geopoint(cityPosition);

            // Set the map location.
            MapControl1.Center = cityCenter;
            MapControl1.ZoomLevel = 12;
            MapControl1.LandmarksVisible = true;
        }

I think the MapServiceToken should be right, because if I change any MapServiceToken character the map display "Warning: MapServiceToken not specified" (and if I put it correctly it doesn't), and also, if I look "usage" in BingsMapsPortal the key has been used, as you can see in next image:

enter image description here

I have tried also create another Tokens and use them with the same result.

Besides, I have tried use the MapServiceToken in "MapControl" sample project in GitHub (https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/MapControl ), with the same result.

Any idea why i'm not able to load any Bing map in ControlMap control?

EDIT: Here is the code, if you want test it: DRIVE LINK

Thx!

CarlosTI
  • 133
  • 11
  • You sure this isn't happening due to slow network connection? When map isn't yet loaded all data, it shows exactly that - blue area. – Andrei Ashikhmin Dec 15 '16 at 04:16
  • Sure, i've tested it in my work, in my home, with mobile hotspot... Allways with the same result :-( – CarlosTI Dec 15 '16 at 10:31
  • It has nothing to do with the token I think because when you leave the token out it still shows the map data, just with the hint that the MapServiceToken is missing. – DevAttendant Dec 15 '16 at 11:34
  • @schumi1331 is correct the map key is not the problem, just leave it out for now. You need to request one when you publish your app to the store. For the showing problem, try adding the code in the Loaded event of the page instead of the OnNavigatedTo. See if that helps, or in the Loaded event of the map control. Because sometimes the map control takes longer to render than the page and will ignore code set before that. – Depechie Dec 16 '16 at 10:26
  • I've tried add the code to loaded page event, and/or to loaded map event with same result. I've shared the code here goo . gl / YRJIK2 (remove spaces) with my bingmaps token key. Can anyone try if it works for him? Thx again! – CarlosTI Dec 16 '16 at 11:55

1 Answers1

0

There are known issues with the map control and certain 3rd party proxy clients and networking software which can block downloading the map data. Are you running software such as Juniper Pulse, or are you behind a corporate proxy server? Another test you can run: If you switch the map control to Aerial3D mode, does data display?

Duncan Lawler
  • 1,772
  • 8
  • 13
  • I've tested map project in mobile device (until now I had tested the app only in PC) and it works! So the problem is related to something blocking loading in PC device (firewall, proxy, antivirus ...) – CarlosTI Dec 22 '16 at 09:42
  • If you do not mind... could you test it in Pc device? The code is up there... Thx very much! – CarlosTI Dec 22 '16 at 09:45
  • Map data is loading normally with the sample you have above, so it seems to be something specific to your PC that is blocking networking traffic. I would check it on other networks (try a laptop on public Wi-Fi for example) to try and narrow down what configuration you have that is blocking traffic. – Duncan Lawler Jan 04 '17 at 19:33