wx.getLocation位置不准确?

发布于 8 年前作者 leijia12872 次浏览最后编辑 8 年前来自 ask

开启了高精度,拿到坐标还是不准确。

onShow: function () {
    var that = this
    wx.getLocation({
      isHighAccuracytrue,
      type'wgs84',
      success(loc){
        console.log(loc)
        that.setData({
          position_lat:loc.latitude,
          position_lng:loc.longitude
        })
      },
      fail(res){
        console.log('fail',res)
      },
      complete(res){
        console.log('comp',res)
      }
    })
  }
2 回复
gangyan
gangyan1 楼5 年前

gcj02 返回可用于 wx.openLocation 的坐标, 是不是type填错了

nacui
nacui2 楼5 年前

需要写上这个参数highAccuracyExpireTime,文档中说高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果

请看一下这个api【wx.getLocation】的具体参数,仔细阅读里面的参数和含义

api链接:https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html