繁体   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