微信小程序定位不精准

开始用的wgs84,偏差很明显,在设置了isHighAccuracy: true以后定位依然有很大的偏差,wgs84(是全球定位系统,获取的坐标,gcj02是国家测绘局给出的坐标)

wx.getLocation({

type: 'wgs84',  //坐标系

isHighAccuracy: true,  //提高精确度

success: function(res) {

that.setData({

latitude: res.latitude,

longitude: res.longitude,

})},

fail: function(res) {},

complete: function(res) {},})

后来改成gcj02,效果显著提升,虽然精准度还是不够,但是比wgs84强了很多。

//请求地理位置

requestLocation: function() {

var that = this;

wx.getLocation({

type: 'gcj02',

isHighAccuracy: true,

success: function(res) {

that.setData({

latitude: res.latitude,

longitude: res.longitude,

})

that.regeocodingAddress();

},

fail: function(res) {},

complete: function(res) {},

})},

遇到使用wgs84定位不标准的,不妨试试gcj02。


版权声明:本文为u013023845原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。