高德地图(纯 室内地图)的 路径规划的结果分析

访问量: 469

可以看出, 没太多东西. 会给出 floor(经过的楼层), 文字提示(text) 和 具体的路径( action)

( 所以, 如果有室内室外混合导航的话, 那么建议直接用室外的) 

{
    "floor":[
        "1",
        "2",
        "4",
        "5"
    ],
    "text":[
        "步行1135689米乘电梯至F2层",
        "步行63米乘电梯至F4层",
        "步行179米乘电梯至F5层",
        "步行1135755米到达目的地"
    ],
    "count":4,
    "action":[
        [
            {
                "end":{
                    "text":"由此乘电梯至F2层",
                    "actFloor":"2"
                },
                "pre":null,
                "next":{
                    "action":"0x03",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"2",
                    "fn":"F2",
                    "geometry":Array[13],
                    "segDistance":63
                },
                "geometry":Array[25],
                "type":"0x03"
            }
        ],
        [
            {
                "start":{
                    "text":"由此乘电梯至F1层",
                    "actFloor":"1"
                },
                "end":{
                    "text":"由此乘电梯至F4层",
                    "actFloor":"4"
                },
                "pre":{
                    "action":"0x03",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"1",
                    "fn":"F1",
                    "geometry":Array[25],
                    "segDistance":1135689
                },
                "next":{
                    "action":"0x03",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"4",
                    "fn":"F4",
                    "geometry":Array[35],
                    "segDistance":179
                },
                "geometry":Array[13],
                "type":"0x03"
            }
        ],
        [
            {
                "start":{
                    "text":"由此乘电梯至F2层",
                    "actFloor":"2"
                },
                "end":{
                    "text":"由此乘电梯至F5层",
                    "actFloor":"5"
                },
                "pre":{
                    "action":"0x03",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"2",
                    "fn":"F2",
                    "geometry":Array[13],
                    "segDistance":63
                },
                "next":{
                    "action":"0x06",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"5",
                    "fn":"F5",
                    "geometry":Array[13],
                    "segDistance":1135755
                },
                "geometry":Array[35],
                "type":"0x03"
            }
        ],
        [
            {
                "end":{
                    "text":"到达目的地",
                    "actFloor":"4"
                },
                "pre":{
                    "action":"0x03",
                    "buildingId":"B0FFG18MQ3",
                    "floor":"4",
                    "fn":"F4",
                    "geometry":Array[35],
                    "segDistance":179
                },
                "next":null,
                "geometry":Array[13],
                "type":"0x06"
            }
        ]
    ]
}

下面是 获取室内路径的办法:

  global_var_indoor_indoor_map = new Indoor.Map('indoor_map_div',{
      key:'6269552399438485be9e72f9785dc??4',
      buildingId:'B0FFG18MQ3',
      floor: 1,
      zoom: 15,
      searchBarControl: false,
      routeControle: true
  });

  //由于地图数据使用了异步加载,为避免出错请把所有的逻辑放在mapready事件内
  global_var_indoor_indoor_map.once('mapready',function(){
      console.log(global_var_indoor_indoor_map.getFloor());

      var start = {},stop={};
      // 泰辣椒  , T3 五层
      start.x = 116.615420
      start.y = 40.056168
      start.floor = 5;

      //
      stop.x = 116.589330
      stop.y = 40.082775
      stop.floor = 2;

      //成功回调 返回路算的信息
      function sucessback(routeInfo){
          console.info('== 路径规划成功')
          console.debug(JSON.stringify(routeInfo));
      }

      //失败 返回失败信息
      function errback(msg){
          console.error('== 路径规划出错了' )
          console.log(msg);
      }
      //开始路算
      global_var_indoor_indoor_map.routePath(start,stop,sucessback,errback,{showTip:true});
  })

订阅/RSS Feed

Subscribe

分类/category