wx.getLocation(Object object)
获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。
object.success 回调函数
参数
Object res
属性 | 类型 | 说明 | 最低版本 |
---|---|---|---|
latitude | number | 纬度,范围为 -90~90,负数表示南纬 | |
longitude | number | 经度,范围为 -180~180,负数表示西经 | |
speed | number | 速度,单位 m/s | |
accuracy | number | 位置的精确度 | |
altitude | number | 高度,单位 m | |
verticalAccuracy | number | 垂直精度,单位 m(Android 无法获取,返回 0) | 1.2.0 |
horizontalAccuracy | number | 水平精度,单位 m |
- 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。