//引入百度 api ak是你百度控制臺(tái)申請(qǐng)的key
http://api.map.baidu.com/api?v=1.0&type=webgl&ak=${ak}&callback=init
// 引入百度路書 api
http://api.map.baidu.com/library/LuShu/gl/src/LuShu_min.js
var styleOptions = {
strokeColor: '#5E87DB', // 邊線顏色
fillColor: '#5E87DB', // 填充顏色。當(dāng)參數(shù)為空時(shí),圓形沒有填充顏色
strokeWeight: 2, // 邊線寬度,以像素為單位
strokeOpacity: 1, // 邊線透明度,取值范圍0-1
fillOpacity: 0.1 // 填充透明度,取值范圍0-1
};
TrackAnimation(type, data,n) {
let that=this
let styleOption = Object.assign({}, styleOptions);
let icon=null
// styleOption.strokeStyle = "dashed"
styleOption.strokeColor = "#2D72DB"
styleOption.strokeWeight = 4
var point = [];
for (var i = 0; i < data.length; i++) {
if(data[i].lon&&data[i].lat){
point.push(new BMapGL.Point(data[i].lon, data[i].lat));
}
}
if(type=='人員軌跡'){
icon=require('../../../../assets/img/map/14814.png')
}else{
icon=require('../../../../assets/img/map/14813.png')
}
var polyline = new BMapGL.Polyline(point,styleOption);
this.map.addOverlay(polyline);
this.polyline=polyline
this.map.setViewport(point) // 自動(dòng)調(diào)整軌跡視野
// 路書
let lushu = new BMapGLLib.LuShu(this.map, polyline.getPath(), {
geodesic: true,
autoCenter: false,//自動(dòng)調(diào)整路線視野
icon: new BMapGL.Icon(icon, new BMapGL.Size(30, 30), { anchor: new BMapGL.Size(15, 15) }),
speed: n, // 速度
enableRotation: false // 圖標(biāo)隨著道路走向旋轉(zhuǎn)
});
console.log(lushu)
this.lushu=lushu
setTimeout(function(){
that.mapZoomOut()
lushu.stop()
lushu.start()
},500)
},
百度地圖路書 使用 軌跡全局觀看
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 首先,先說說我用到的幾個(gè)框架:BaiduMapAPI_Base.framework 百度地圖使用時(shí)必不可少的一個(gè)基...
- 坑 路線繪制完畢的時(shí)候,想要截圖,但是死活不能截取到完整的“起點(diǎn)”+“終點(diǎn)”圖片,即使在截圖之前將地圖的cente...
- 前言 需要實(shí)現(xiàn)員工巡查功能,展示地圖,并顯示員工當(dāng)前所在位置。當(dāng)該員工點(diǎn)擊“開始巡查”按鈕,則追隨其腳步,進(jìn)行軌跡...
- >=3.0版本的接入(適配XCode8.3以上) 登錄百度地圖開放平臺(tái),找到iOS的鷹眼軌跡的SDK,下載,然后把...
- 轉(zhuǎn)載、引用請(qǐng)標(biāo)明出處http://www.itdecent.cn/p/3c3d9e92739d本文出自zhh_ha...