1
votes

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!

1
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
Sure, i've tested it in my work, in my home, with mobile hotspot... Allways with the same result :-( - CarlosTI
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
@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
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

1 Answers

0
votes

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?