永久
永久
  • 发布:2015-07-08 11:23
  • 更新:2016-04-26 08:37
  • 阅读:3265

究竟是gps定位还用百度定位,怎么不准确?

分类:HTML5+

通过配置,百度定位是可以的

    plus.geolocation.getCurrentPosition(function (e){  
    in_x=e.coords.longitude;  
    in_y=e.coords.latitude;  
    map.setCenter(new plus.maps.Point(e.coords.longitude,e.coords.latitude));  
    }, function (e){  
        plus.nativeUI.toast("获取百度定位位置信息失败:"+e.message);  
    },{provider:'baidu'});  

    map.showUserLocation( true );  
    map.getUserLocation(function(state,pos){  
        if(0==state){  
            document.getElementById("z2").innerHTML=pos.getLng();     
        }  
    });

以上getCurrentPosition和getUserLocation者可以,但是不精确,我现在想精确到5米以内,也就是象百度地图开GPS那样,但是我亲自测试确实不准确,差别至少50米以上,反而关闭APP再打开第一次定位好象准确些,之后再点击不行。问题是
1、getCurrentPosition和getUserLocation为什么获取的值都是一样的,难道不是getCurrentPosition更准确?
2、如何知道getCurrentPosition是通过gps还是网络获取的位置,网络肯定不准确?
3、如何把误差受制再3米或者5米以内,几十米肯定不行了?

2015-07-08 11:23 1 条评论 负责人:无 分享
已邀请:
云钦

云钦 - 学习中

同问,正在寻找答案,如果你解决了,回来告知一下

云钦

云钦 - 学习中

map.getUserLocation是纯gps定位,比较靠谱,室内可能会偏,这就是gps定位的缺点,
但是map.setCenter,方法好像无效,官方的demo也没有实现移动中,实时显示地图的中心。

  • l***@163.com

    map.getUserLocation获取的不是gps坐标,实测是错误的

    2016-09-27 08:33

  • 云钦

    你再测测,确定手机开启GPS了?

    2016-10-08 11:55

该问题目前已经被锁定, 无法添加新回复