getLocation和onLocationChange定位,前后几秒存在500米误差?
发布于 5 年前 作者 qiangzheng 3901 次浏览 来自 官方Issues
-【公司的同事也复现了这个问题,我们可以上传今天的调用日志协助API开发者排查问题】

- 以下是API的主要调用方式:
  wx.getLocation({
    type: 'gcj02',
    success: res => {},
    fail: res => {}
  })

  wx.startLocationUpdate()
  wx.onLocationChange(res => {})

-以下是线上用户的日志(getLocation和onLocationChange的返回记录,分别在两个数组里,有时间戳):
    "onLocationChangeLogStack": [
      {
        "log": "第0项日志",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.273546549479168,
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98670762803819,
          "direction": 0
        },
        "timestamp": 1640912040378
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.275212944878472,
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98674289279514,
          "direction": 0
        },
        "timestamp": 1640912041363,
        "time": "08:54:01"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 28.595458984375,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "gps",
          "latitude": 30.275257161458335,
          "accuracy": 15.087242126464844,
          "horizontalAccuracy": 15.087242126464844,
          "type": "gcj02",
          "steps": 0,
          "speed": 0.9399999976158142,
          "longitude": 119.98688123914931,
          "direction": 49.5
        },
        "timestamp": 1640912043312,
        "time": "08:54:03"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 26.94659423828125,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "gps",
          "latitude": 30.27526611328125,
          "accuracy": 19.00754165649414,
          "horizontalAccuracy": 19.00754165649414,
          "type": "gcj02",
          "steps": 0,
          "speed": 0.9399999976158142,
          "longitude": 119.98689208984375,
          "direction": 49.5
        },
        "timestamp": 1640912044285,
        "time": "08:54:04"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.274973415798613,
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98738661024305,
          "direction": 0
        },
        "timestamp": 1640912279392,
        "time": "08:57:59"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.274985894097224,
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98747043185764,
          "direction": 0
        },
        "timestamp": 1640912281414,
        "time": "08:58:01"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.274640028211806,
          "accuracy": 15,
          "horizontalAccuracy": 15,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98615234375,
          "direction": 0
        },
        "timestamp": 1640912606404,
        "time": "09:03:26"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912614404,
        "time": "09:03:34"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912622407,
        "time": "09:03:42"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912632259,
        "time": "09:03:52"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912647807,
        "time": "09:04:07"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.27372802734375,
          "accuracy": 306,
          "horizontalAccuracy": 306,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98235324435764,
          "direction": 0
        },
        "timestamp": 1640913353009,
        "time": "09:15:53"
      },
      {
        "log": "onLocationChange_success",
        "logContent": {
          "altitude": 0,
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.273546549479168,
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98670762803819,
          "direction": 0
        },
        "timestamp": 1640913355016,
        "time": "09:15:55"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640913363595,
        "time": "09:16:03"
      }
    ],

    "getLocationLogStack": [
      {
        "log": "第0项日志",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.273546549479168,
          "errMsg": "getLocation:ok",
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98670762803819,
          "direction": 0
        },
        "timestamp": 1640912040378
      },
      {
        "log": "getLocation_success",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.275212944878472,
          "errMsg": "getLocation:ok",
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98674289279514,
          "direction": 0
        },
        "timestamp": 1640912041965,
        "time": "08:54:01"
      },
      {
        "log": "getLocation_success",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.274973415798613,
          "errMsg": "getLocation:ok",
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98738661024305,
          "direction": 0
        },
        "timestamp": 1640912279687,
        "time": "08:57:59"
      },
      {
        "log": "getLocation_success",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.274640028211806,
          "errMsg": "getLocation:ok",
          "accuracy": 15,
          "horizontalAccuracy": 15,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98615234375,
          "direction": 0
        },
        "timestamp": 1640912606596,
        "time": "09:03:26"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912616342,
        "time": "09:03:36"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912625900,
        "time": "09:03:45"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912635401,
        "time": "09:03:55"
      },
      {
        "logContent": "___same___",
        "timestamp": 1640912647918,
        "time": "09:04:07"
      },
      {
        "log": "getLocation_success",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.27372802734375,
          "errMsg": "getLocation:ok",
          "accuracy": 306,
          "horizontalAccuracy": 306,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98235324435764,
          "direction": 0
        },
        "timestamp": 1640913353298,
        "time": "09:15:53"
      },
      {
        "log": "getLocation_success",
        "logContent": {
          "verticalAccuracy": 0,
          "indoorLocationType": -1,
          "provider": "network",
          "latitude": 30.273546549479168,
          "errMsg": "getLocation:ok",
          "accuracy": 30,
          "horizontalAccuracy": 30,
          "type": "gcj02",
          "steps": 0,
          "speed": 0,
          "longitude": 119.98670762803819,
          "direction": 0
        },
        "timestamp": 1640913363578,
        "time": "09:16:03"
      }
  • ],
3 回复

你好,麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点(具体到分钟)

不是因为坐标系不同?

从日志可以看出:
09:15:53 的经纬度为:119.98235324435764,30.27372802734375

09:15:55 的经纬度就成了:119.98670762803819,30.273546549479168

大约偏差了400多米

线上多个用户的日志分析结果也会如此,一般是500左右的误差

回到顶部