【问题标题】:Azure Maps - Cannot see the mapAzure Maps - 看不到地图
【发布时间】:2021-06-10 15:53:06
【问题描述】:

我正在学习本教程 (https://docs.microsoft.com/en-us/learn/modules/create-your-first-iot-central-app/) 在第 4 单元中,我遵循了所有步骤,但我看到的只是一个这样的空白页

Unit 4 exercise result

<!DOCTYPE html>
<html>

<head>
    <title>Map</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css">
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>

    <!-- Add a reference to the Azure Maps Services Module JavaScript file. -->
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas-service.min.js"></script>

    <script>
        function GetMap() {
            //Instantiate a map object
            var map = new atlas.Map("myMap", {
                //Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps
                authOptions: {
                    authType: 'subscriptionKey',
                    subscriptionKey: 'mB~~~~~~(I wrote my maps primary key here)'
                }
            });
        }
    </script>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }

        #myMap {
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body onload="GetMap()">
    <div id="myMap"></div>
</body>

</html>

Azure Maps Resource

此反馈页面也不起作用... (https://feedback.azuremaps.com/)

Feedback Maps

另外,在这个网站上,当我按“在新标签中打开”时,我什么也看不到... (https://azuremapscodesamples.azurewebsites.net/)

Code samples Maps

我花了将近 4 个小时,但找不到解决方案... 我需要做什么才能在这些页面上看到正确的地图?

【问题讨论】:

    标签: azure azure-maps


    【解决方案1】:

    如果使用 Azure Maps 的所有不同站点都不适合您,可能是以下原因之一:

    【讨论】:

    • 非常感谢。这是由于我的位置。当我使用 VPN 时是否可用?
    【解决方案2】:

    检查地图如何开始

     $(document).ready(function () {
        InitMap();
    });
    
    function InitMap() {
    
        var map = new atlas.Map('myMap', {
            center: [-73.98235, 40.76799],
            zoom: 10,
            language: 'en-US',
            authOptions: {
                authType: 'subscriptionKey',
                subscriptionKey: 'key1*****'
            }
        });
    
    }
    
    $(document).ready(function () {
        InitMap();
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-30
      相关资源
      最近更新 更多