WeChat Mini Program API Check Location


wx.openLocation(OBJECT)


Use WeChat’s built-in map to view the location

OBEJCT parameter description:

QQ截图20170208113613.png

Sample code:

wx.getLocation({
  type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  success: function(res) {    var latitude = res.latitude    var longitude = res.longitude
    wx.openLocation({
      latitude: latitude,
      longitude: longitude,
      scale: 28
    })
  }
})


##Bug & Tip

  1. bug: iOS 6.3.30 The type parameter does not take effect, only wgs84 type coordinate information will be returned
  2. tip: wx.getLocation, wx.chooseLocation interfaces require user authorization, please be compatible with the scenario where the user refuses authorization.