WeChat Mini Program API Get Location


wx.getLocation(OBJECT)


Get the current geographical location and speed. When the user leaves the mini program, this interface cannot be called; when the user clicks "Show on top of chat", this interface can continue to be called.

OBJECT parameter description:

QQ截图20170208113221.png

##success return parameter description:

QQ截图20170208113226.png

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.chooseLocation(OBJECT)

Open map selection Position

OBJECT parameter description:

QQ截图20170208113232.png

##success return parameter description: