簡體   English   中英

Azure Maps Indoor Creator 不渲染

[英]Azure Maps Indoor Creator not rendering

我正在關注這些教程:

我已經成功創建了我的數據集和圖塊集,但是我似乎無法渲染第二個鏈接中顯示的任何內容。 它只是顯示為空白頁。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, user-scalable=no" />
    <title>Indoor Maps App</title>
    
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
    <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/indoor/0.1/atlas-indoor.min.css" type="text/css"/>

    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
    <script src="https://atlas.microsoft.com/sdk/javascript/indoor/0.1/atlas-indoor.min.js"></script>
      
    <style>
      html,
      body {
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
      }

      #map-id {
        width: 100%;
        height: 100%;
      }
    </style>
  </head>

  <body>
    <div id="map-id"></div>
    <script>
      const subscriptionKey = "xxxxxxxxxxxxxxxxxx";
      const tilesetId = "af4e9dbf-9f7d-19c3-4d96-017353097e54";
      const statesetId = "485352c8-8cea-f1d4-ab23-17654b8b90f2";

      const map = new atlas.Map("map-id", {
        //use your facility's location
        center: [-122.13315, 47.63637],
        //or, you can use bounds: [# west, # south, # east, # north] and replace # with your Map bounds
        style: "blank",
        view: 'Auto',
        authOptions: { 
             authType: 'subscriptionKey',
             subscriptionKey: subscriptionKey
        },
        zoom: 9,
      });

      const levelControl = new atlas.control.LevelControl({
        position: "top-right",
      });

      const indoorManager = new atlas.indoor.IndoorManager(map, {
        levelControl: levelControl, //level picker
        tilesetId: tilesetId,
        statesetId: statesetId // Optional
      });

      if (statesetId.length > 0) {
        indoorManager.setDynamicStyling(true);
      }

      map.events.add("levelchanged", indoorManager, (eventData) => {
        //put code that runs after a level has been changed
        console.log("The level has changed:", eventData);
      });

      map.events.add("facilitychanged", indoorManager, (eventData) => {
        //put code that runs after a facility has been changed
        console.log("The facility has changed:", eventData);
      });
    </script>
  </body>
</html>

誰能看到我做錯了什么?

  • 根據這個SO 線程,如果您表示僅加載外部和單元並且沒有通過 label 層,它會帶來標簽並允許您向單元添加更多屬性,如果您沒有看到 map,請嘗試檢查轉換結果,這始終是一個好習慣。
  • 另一個解決問題的有用方法是使用 WFS API查看數據集中的內容,例如單位通過https://atlas.microsoft.com/wfs/datasets/ /collections/unit/items?api-version= 1.0&subscription-key={{subscriptionkey}}
  • 另外,請參考這個類似的SO 線程

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM