WeChat Mini Program API Location
wx.getLocation(OBJECT)
WeChat applet obtains the current geographical location and speed
OBJECT parameter description:
success Return parameter description:
Sample code:
wx.getLocation({ type: 'wgs84', success: function (res) { var latitude = res.latitude; var longitude = res.longitude; var speed = res.speed; var accuracy = res.accuracy; } });
wx.openLocation(OBJECT)——View the latest version
The WeChat applet uses WeChat’s built-in map to view the location
OBEJCT parameter description:
Sample code:
wx.getLocation({ type: 'gcj02', //返回可以用于wx.openLocation的经纬度 success: function (res) { var latitude = res.latitude; var longitude = res.longitude; wx.openLocation({ latitude:latitude, longitude:logitude, scale:1 }) } });