帖子
帖子
用户
博客
课程
显示全部楼层
89
帖子
0
勋章
201
Y币

[BUG] bMap定位接口问题。

[复制链接]
发表于 2017-10-11 21:37:06
本帖最后由 帝邦 于 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还是采用的百度地图坐标系有什么有问题?

23
帖子
1
勋章
988
Y币
wifi下还是移动网络
2
帖子
0
勋章
2271
Y币
您好,在iOS还是Android上测试的?
89
帖子
0
勋章
201
Y币
cjapi 发表于 2017-10-11 23:39
您好,在iOS还是Android上测试的?

两个系统都一样。
89
帖子
0
勋章
201
Y币
cjapi 发表于 2017-10-11 23:39
您好,在iOS还是Android上测试的?

经测试:在手机流量使用的时候,定位的位置与实际位置相差好几百米,而使用WIFI定位的时候跟实际位置相差很少。请问可以加一个参数,选择定位方式的选择,如果GPS,WIFI和基站定位。或者他们的组合。
您需要登录后才可以回帖 登录

本版积分规则