First, the effect drawing

Two, operation steps

1. Apply for Tencent Map Key –address

2, small program background add Tencent plug-in –Development of the document

3, small program code app.json Settings

let plugin = requirePlugin('routePlan');
let key = ' ';  // Use the key applied in Tencent location service
let referer = ' ';   // The name of the app calling the plug-in
let endPoint = JSON.stringify({  / / the end
    'name': 'Yoshinoya (Beikou Branch, Beijing West Railway Station)'.'latitude': 39.89631551.'longitude': 116.323459711
});
wx.navigateTo({
    url: 'plugin://routePlan/index? key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
});
Copy the code

Or you can use the applets to build in map navigation

Use the applet to build in maps wx.getLocation and wx.openLocation

The website links

//wxml
<button type="default" bindtap="openMap">Open the map</button>
Copy the code
//js
Page({
  data: {},openMap: function () {
    wx.getLocation({
      type: 'gcj02'.// By default, wGS84 returns GPS coordinates and gcj02 returns coordinates available for wx.openLocation
      success: function (res) {
        // success
        console.log(res.latitude);
        console.log(res.longitude);
        wx.openLocation({
          latitude: res.latitude, // The latitude ranges from -90 to 90, with negative numbers representing southern latitudes
          longitude: res.longitude, // The longitude ranges from -180 to 180, with the negative number indicating the west longitude
          scale: 28.// Scale
          name:"The name of the place I'm looking for (the hotel)".address:"Address: A detailed description of the location to be visited."})}})Copy the code