wx.chooseLocation中显示的不是我传入的位置?

小程序 文章 2022-04-28 10:00 0 全屏看文

wx.chooseLocation中显示的不是我传入的位置?Wx.chooseLocation is not showing the location I passed in?

wx.chooseLocation中显示的不是我传入的位置?

为什么我使用wx.getLocation获取我当前的位置传入wx.chooseLocation中显示的不是我当前的位置,基础库没问题。

          wx.getLocation({            type'wgs84',            success(getLocationRes) {              let latitude = getLocationRes.latitude;              let longitude = getLocationRes.longitude;              // 打开地图选择位置              wx.chooseLocation({                latitude : latitude,                longitude : longitude,                success(chooseLocationRes){                  console.info("选择结果:"+JSON.stringify(chooseLocationRes));                }              })       })

Why do I use Wx Getlocation gets my current location and passes it into Wx What is displayed in chooselocation is not my current location. There is no problem with the basic library.           wx. Getlocation ({type: 'WGS84', success (getlocationres) {let} latitude = getlocationres.latitude; let} longitude = getlocationres.longitude; / / open the map and select location {wx.chooselocation( {latitude: latitude, longitude: longitude, success (chooselocationres) {console.info ("selection result:" + json.stringify (chooselocationres));                 }              }) })

回答:

订阅happiness:

把wgs84 改为gcj02

慢慢。:

应该是坐标系选错了,wx.getLocation 返回的是 wgs84 坐标系,而 wx.chooseLocation 的经纬度参数是指 gcj02 坐标系,那肯定会有偏差啊。

跨商通:

1、坐标写死测试一下。

天下第一:写死试了,有偏移

-EOF-