1. 百度地圖的路書在實質上才像是軌跡回放,可以根據方位角進行圖標方向的變化,
或許也就是在前面的沿線運動時,把圖標按照一定的角度轉換了一下吧。
2. 路書使用 BMapLib.LuShu 函數, arrPois 是 DrivingRoute 查詢到的數據。
1 lushu = new BMapLib.LuShu(map,arrPois,{ 2 defaultContent:"", 3 autoViewport:true, 4 icon:new BMap.Icon('../img/start.png',new BMap.Size(52,26),{anchor:new BMap.Size(27,13)}), 5 speed: 4500, 6 enableRotation:true, 7 landmarkPois:[ 8 {lng:116.314782,lat:39.913508,html:'加油站',pauseTime:2}, 9 {lng:116.315391,lat:39.964429,html:'高速公路收費<div><img src="//map.baidu.com/img/logo-map.gif"/></div>',pauseTime:3}, 10 {lng:116.381476,lat:39.974073,html:'肯德基早餐',pauseTime:2} 11 ]}); 12 13 lushu.start(); 14 }
3. 頁面顯示
4. 代碼參考
https://github.com/WhatGIS/bdMap