// 获取经纬度
uni.getLocation({
type: 'gcj02',
isHighAccuracy: true,
success(res) {
let { latitude, longitude } = res
let x = longitude
let y = latitude
let x_pi = (3.14159265358979324 * 3000.0) / 180.0
let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi)
let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi)
let lngs = z * Math.cos(theta) + 0.0065
let lats = z * Math.sin(theta) + 0.006
that.signInfo.lat = lats
that.signInfo.lng = lngs
}
})
uni.getLocation获取经纬度不准确修改方法
最新推荐文章于 2024-04-30 16:57:21 发布