|
发表帖子
API/SDK版本号: |
1.4.5 |
产品: |
2D地图 |
手机型号: |
|
使用接口: |
marker.moveAlong |
本帖最后由 于 2018-3-26 22:00 编辑
我在使用车辆轨迹回放的时候遇到报错如下
Uncaught TypeError: a.Wa is not a function
at c.moveTo (eval at <anonymous> (maps:3), <anonymous>:481:273)
at c.lda (eval at <anonymous> (maps:3), <anonymous>:484:72)
at c.moveChanged (eval at <anonymous> (maps:3), <anonymous>:481:153)
at c.RC (eval at <anonymous> (maps:3), <anonymous>:56:329)
at c.eval (eval at <anonymous> (maps:3), <anonymous>:55:803)
at c.r (eval at <anonymous> (maps:3), <anonymous>:55:39)
at c.RC (eval at <anonymous> (maps:3), <anonymous>:56:362)
at c.set (eval at <anonymous> (maps:3), <anonymous>:55:459)
at c.moveAlong (eval at <anonymous> (maps:3), <anonymous>:259:189)
at Object.success (openGpsHisPage:4418)
我的代码如下
var marker, lineArr = [];
var path = '<%=request.getContextPath()%>';
var map = new AMap.Map("container", {
resizeEnable: true,
center: [120.620704, 31.256295],
zoom: 17
});
marker = new AMap.Marker({
map: map,
position: [120.620704, 31.256295],
icon: basePath + "/static/image/slc.png",
offset: new AMap.Pixel(-26, -13),
autoRotation: true
});
/* var lngX = 116.397428, latY = 39.90923;
lineArr.push([lngX, latY]);
for (var i = 1; i < 4; i++) {
lngX = lngX + Math.random() * 0.05;
if (i % 2) {
latY = latY + Math.random() * 0.0001;
} else {
latY = latY + Math.random() * 0.06;
}
lineArr.push([lngX, latY]);
} */
// 绘制轨迹
var polyline = new AMap.Polyline({
map: map,
path: lineArr,
strokeColor: "#00A", //线颜色
// strokeOpacity: 1, //线透明度
strokeWeight: 3, //线宽
// strokeStyle: "solid" //线样式
});
var passedPolyline = new AMap.Polyline({
map: map,
// path: lineArr,
strokeColor: "#F00", //线颜色
// strokeOpacity: 1, //线透明度
strokeWeight: 3, //线宽
// strokeStyle: "solid" //线样式
});
marker.on('moving',function(e){
passedPolyline.setPath(e.passedPath);
})
map.setFitView();
AMap.event.addDomListener(document.getElementById('start'), 'click', function() {
var devNo = $("#carCode").val();
var searchTimeStart = $("#searchTimeStart").val();
var searchTimeEnd = $("#searchTimeEnd").val();
if(checkNotNull(devNo)&&checkNotNull(searchTimeStart)
&&checkNotNull(searchTimeEnd)){
$.ajax({
type:"POST",
async:false,
url:path+"/gps/getGpsHisData",
data:{"devNo":devNo,"searchTimeStart":searchTimeStart,"searchTimeEnd":searchTimeEnd},
dataType:'json',
success:function(data){
if(data.flag == "success"){
var gpsList = eval(data.gpsList);
for(var i =0;i<gpsList.length;i++){
lineArr.push([gpsList.gpsLng, gpsList.gpsLat]);
}
alert(lineArr);
marker.moveAlong(lineArr, 500);
}else{
layer.msg("该车辆在该时间段内无定位数据");
}
}
});
}else if(!checkNotNull(devNo)){
layer.msg("请选中具体车牌");
}else if(!checkNotNull(searchTimeStart)){
layer.msg("请选择起始时间");
}else{
layer.msg("请选择结束时间");
}
}, false);
AMap.event.addDomListener(document.getElementById('pause'), 'click', function() {
marker.pauseMove();
}, false);
AMap.event.addDomListener(document.getElementById('resume'), 'click', function() {
marker.resumeMove();
}, false);
AMap.event.addDomListener(document.getElementById('stop'), 'click', function() {
marker.stopMove();
}, false);
我测试了一下,id为start的按钮点击后触发的ajax里我获取到了定位数据,并且也按照格式放入lineArr里,但一点击按钮,页面没有反应,控制台出现这个让我摸不着头脑的报错,哪位大神帮帮忙,告诉我是哪里出的问题?
|
|