这是运行Azure Maps示例的另一个后续操作。
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'
});
});
消息:“错误请求” 名称:“ wt” 堆栈:“” 状态:400 网址:“ 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”
显示地图,但地图完全空白。启动页面时,会多次抛出此错误。再次从示例中直接复制代码,此时没有任何修改。
TIA! 里克...
答案 0 :(得分:0)
我最终翻阅了很多行错误代码,发现原来是MS Visual Code,再次更改了复制文本的大小写。风景: '';新地图实例中的参数已将“自动”更改为“自动”。我更正了它,现在可以按预期运行! 以为我会通过... 里克...