郊区wx.getLocation误差几公里,提高精度方法?
发布于 5 年前 作者 kangwei 4016 次浏览 来自 官方Issues

在郊区wx.getLocation 获取的定位地址误差达到几公里,这是本身的通病吗?难道没有别的方法可以精准定位吗?现在公司业务要求误差不能超过100米。

wx.showLoading({
          title: "正在定位...",
          mask: true
        });
wx.getLocation({
 type: 'gcj02',
 altitude:'true',
 isHighAccuracy: true,
 highAccuracyExpireTime:3000,
 success: res => {
  console.debug("res", res);
  const latitude = res.latitude;
  const longitude = res.longitude;
  //console.debug("latitude", latitude);
  //console.debug("longitude", longitude);
  url += "&latitude=" + latitude + "&longitude=" + longitude+ "&brand=" + systemInfo.brand
              + "&model=" + systemInfo.model +"&nickname="+username;
  this.jump(url);
 },
 fail: err => {
  console.debug("err", err);
  Toast("获取定位信息失败!");
  this.jump(url);
 },
  complete: res => {
    wx.hideLoading();
  }
})


1 回复

你好,小程序目前支持:

1.getLocation接口高精度定位的能力https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html;

2.持续定位的接口(精度会随着定位时间,越来越高)https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html

回到顶部