0
votes

This is another follow-up on running Azure Maps Example.

    var map = new atlas.Map('theMap', {
    // Only allow one copy of the world be rendered when zoomed out.
    renderWorldCopies: false,
    language: 'en-US',
    center: [-122.33, 47.6],
    zoom: 12,
    view: 'auto',
    authOptions: {
        authType: 'subscriptionKey',
        subscriptionKey: 'myKey', // Removed for security here
        getToken: function(resolve, reject, map) {
            fetch(url).then(function(response) {
                return response.text();
            }).then(function(token) {
                resolve(token);
            });
        }
    }
});

// Wait until the map resources are ready.
map.events.add('ready', function () {
    // Add your post map load code here.
    map.controls.add(new atlas.control.StyleControl({
        mapStyles: ['road', 'road_shaded_relief', 'satellite', 'satellite_road_labels'],
        layout: 'list',
        style: 'road'
    }), {
        position: 'top-right'
    });
});

message: "Bad Request" ​name: "wt" ​stack: "" ​status: 400 ​url: "https://atlas.microsoft.com/map/tile/pbf?language=en-US&view=auto&api-version=1.0&layer=basic&style=main&zoom=12&x=2590&y=2855&subscription-key=myKey"

The map displays but map is completely blank. This error is thrown several times when launching page. Again code copied directly from example with no modifications at this time.

TIA! Rick...

1
Not sure about Azure maps, but "Bad request" generally means that a required request parameter is absent, or of incorrect format. - Anis R.
Also, you definitely should remove the subscription key from the shown URL... - Anis R.
Thanks! I overlooked that. - Rick

1 Answers

0
votes

I finally dug through the many lines of error code and found out that it turned out to be MS Visual Code once again changing case on copied text. The view: ''; parameter in the new map instance had turned 'Auto' into 'auto'. I corrected that and it works as expected now! Thought I'd pass this along... Rick...