h***@126.com
h***@126.com
  • 发布:2025-09-02 11:17
  • 更新:2025-09-02 11:23
  • 阅读:27

uni.getLocation微信小程序定位偏移太大,几百米

分类:HBuilder

代码如下,获取到的GPS坐标实际便宜几百米。如何解决

uni.getLocation({
type: 'wgs84',
geocode: true,
isHighAccuracy: true,
highAccuracyExpireTime: 10000,
success: function (res) {
console.log('当前位置:' + JSON.stringify(res));
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
},
fail: function (error) {
console.log("定位失败原因==", JSON.stringify(error))
}
});

2025-09-02 11:17 负责人:无 分享
已邀请:
蔡cai

蔡cai - 开发的插件:https://ask.dcloud.net.cn/article/41539

type你换成gcj02看看

DCloud_UNI_JBB

DCloud_UNI_JBB

可以去微信社区看看有没有解决方案,这个API是直接调用的微信API

要回复问题请先登录注册