|
本帖最后由 帝邦 于 2017-10-11 22:04 编辑
function setTimer() {
var Timer = api.require('myTimer');
Timer.startTimer({
step : 10,
isLoop : true
}, function(ret) {
if (ret.status) {
bMap.getLocation({
accuracy : '10m',
autoStop : true,
filter : 1
}, function(ret, err) {
if (ret.status) {
//alert(JSON.stringify("lon:" + ret.lon + " lat:" + ret.lat));
//initbmapandshow(ret.lon, ret.lat);
//getGPScityname(ret.lon, ret.lat)
bMap.setCenter({
coords : {
lon : ret.lon,
lat : ret.lat
},
animation : true,
});
moveAnnotationOnthisMap(ret.lon, ret.lat);
setlonlattomain(ret.lon, ret.lat);
} else {
api.toast({
msg : '定位失败!请到户外空旷环境尝试',
duration : 2000,
location : 'bottom'
});
}
});
}
//alert(JSON.stringify(ret));
});
}
以上函数是利用定时器每10秒定位一次。发现问题是:10秒之间在同一个位置定位可能会产生位置差距大约在好几百米甚至一公里以上。我把精度设成:accuracy : '10m', 10米的,感觉定位精度差距还是很大,这是BUG还是采用的百度地图坐标系有什么有问题?
|
|