2***@qq.com
2***@qq.com
  • 发布:2023-05-23 09:03
  • 更新:2023-12-13 22:59
  • 阅读:603

app端使用uni.getLocation定时获取经纬度,经常会出现定位不准确,绘制的轨迹偏移很大,这应该怎么解决呢?

分类:uni-app
<map id="map" style="width: 100%; height: 300px;margin: 10rpx 0;" :latitude="latitude"  :longitude="longitude" :markers="covers" :polyline='polyline' />  

setInterval(() => {     
        uni.getLocation({    
          type: "gcj02",    
          isHighAccuracy: true,    
          success: (res) => {    
            let longitude = res.longitude;    
            let latitude = res.latitude;    
            //polyline    
            this.polyline[0].points.push({ longitude, latitude });    
            //center    
            this.longitude = longitude;    
            this.latitude = latitude;    
            //marker    
            this.covers[0].longitude = longitude;    
            this.covers[0].latitude = latitude;    

            this.polyline = [...this.polyline];    
            this.covers = [...this.covers];    
          },    
          fail: (res) => {}    
        });    
      }, 10000);  

轨迹1

轨迹2

app端用的是高德定位,appkey也申请了,也能正常获取坐标,就是坐标不准,该咋办呢?
恳请各位大佬进行指点!!!实在是找不到解决方案了

2023-05-23 09:03 负责人:无 分享
已邀请:
piaoyi_UI

piaoyi_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序

不太了解什么情况

快码无敌

快码无敌

我的也是,解决了么?

Cherishs

Cherishs

解决了吗博主

DCloud_heavensoft

DCloud_heavensoft

手机开启高精度定位了吗?
官方有一个unicloud-map,你可以试下在这个手机上有没有问题

要回复问题请先登录注册