数据返回经纬度位置
坐标系转换后实际位置
getPolyline(e) {
this.loading = true;
this.playIndex = 0;
this.deviceDetail = { detail: { car_number: e.car_number } };
let param = {
params: {
limit_size: 1000,
time_begin: e.time_begin,
time_end: e.time_end,
is_all: false,
simei: e.simei
},
module: "location",
func: "QueryLocation"
};
lak_mapi(this.loginInfo.sid, param).then(res => {
if (res.errcode === 0) {
if (!res.data || res.data == []) {
this.$message({ type: "error", message: "未获取到相关轨迹信息" });
this.loading = false;
return;
}
let resData = (res.data || []).filter((fil, index) => {
return fil.direction || index === 0;过滤空坐标排查第一个
});
let points = [];
this.detailList = resData;
resData.forEach((item, index) => {
points.push(
new BMap.Point(item.wgs.split(",")[1], item.wgs.split(",")[0])
);
});
this.num = 0;
this.detailTempList = [];
this.getConvertor(points);
} else {
this.loading = false;
this.$message({ type: "error", message: res.error_message });
}
});
},
getConvertor(points) {
//坐标系转换
var convertor = new BMap.Convertor();
convertor.translate(//每次取原数组中十位转换
points.slice(this.num * 10, (this.num + 1) * 10),1,5,data => {
this.num++;//记录事件轮询次数
if (data.status === 0) {//拼接转换后数据
this.detailTempList = this.detailTempList.concat(data.points);
if (this.num * 10 >= points.length) {
this.batchChange();//遍历完成执行数据渲染
} else {
this.getConvertor(points);
}
} else {
this.$message({
type: "error",
message: "系统解析错误,请稍后尝试"
});
}
}
);
},
实际车辆轨迹信息
转换前车辆轨迹 明显偏移不在道路上