1 Map call up (URI API)
: URI for API is a set of open tencent map website or open the user’s phone installed on tencent map products protocol interface, generally in the third party sites or related applications need to use the map function, can launch tencent map products through the interface of different function modules, to provide users with a map and navigation services.
2 function
: Surrounding location search, bus search, route navigation, reverse address resolution, location annotation, Street View display applicable development platform: for browser: WebPC version of Tencent Map, mobile browser VERSION of Tencent map H5 Tencent map for mobile APP: Android version of Tencent Map, iOS version Tencent Map
Three calls
3.1 Web client calls
3.1.1 Interface Invocation Description
A complete URI call needs to contain two parts of information: reference address, method and parameter to specify the enabled Tencent map product type Web/Wap version map: apis.map.qq.com/uri/v1/
3.1.2 Methods and parameters
Specify the enabled function and the parameters required for the function. Format: method? Param = value [& param = value &…
Method is the name of the method. The specific supported methods are: Search, location/bus search, and peripheral search. Routeplan, route planning, including public transportation and driving; Geocoder, inverse address resolution; Marker, location marking; Streetview, streetview.
3.1.3 Sample analysis
Apis.map.qq.com/uri/v1/sear…
apis.map.qq.com/uri/v1/ is the reference address, search is the method name, keyword, region, referer is the parameter name.
Web browser opening effect
Open the sample effects in the mobile browser
3.2 the Android/iOS calls
- Interface Call Description
It is suitable for activating Tencent Map APP in mobile APP and mobile browser. For iOS, the call is made using Scheme, and for Android, the call is made using Intent. The unified protocol is qqmap://map/, and the canOpenURL of the system is directly called to determine
- APP determines whether Tencent map is installed in the phone
Android system: check the package name com.0700. map iOS system: Tencent Map URLSheme is QQmap ://, directly call canOpenURL of the system to judge 3. Open Tencent Map Download page When users do not have Tencent Map APP installed in their mobile phones, they can adjust the Tencent Map download page through the browser to provide users with download, realizing the experience closed loop. Download page link:Pr.map.qq.com/j/tmap/down…A. This page will automatically distinguish Android and iOS, and download the corresponding APP package;
B. YourKey: a developer Key, optional (click here to apply (https://lbs.qq.com/dev/console/key/add), the Key type selection "browser"), used for identification of authorshipCopy the code
The results
4 Route Planning
4.1 Navigation and route planning
According to the designated starting point, destination and travel mode, the route planning function of Tencent Map APP is activated to query the travel route and display it in the map. Android and iOS call address qqmap://map/routeplan
4.2 Function Parameter List
2 Android/iOS calls
Parameter names | mandatory | instructions | The sample |
---|---|---|---|
type | is | Route planning parameters: Bus: Drive walk: walk cycling: bike | Type =bus or type= Drive or type=walk or type=bike |
from | no | Starting from the name | The from = drum tower |
fromcoord | is | Start point coordinates, format: LAT, LNG (latitude first, longitude second, comma separated | Fromcoord = 39.907380, 116.388501 fromcoord = CurrentLocation |
to | no | At the end of the name | Olympic Forest Park |
tocoord | is | End point coordinates | Tocoord = 40.010024, 116.392239 |
referer | is | Please fill in the developer key | Referer = ob4bz-d4W3u-b7VVO-4pjwW-6tkdj-wPB77 Call example |
The test sample | |||
Pull up the Tencent map APP to show the driving route from China University of Petroleum to Tian ‘anmen | |||
qqmap://map/routeplan? Type =drive&from= China University of Petroleum &fromcoord=39.994745,116.247282&to= Tiananmen & Tocoord =39.867192,116.493187&referer= OB4bZ-D4W3U-b7vVO-4pjw W-6TKDJ-WPB77 |
4.2.2 Calling on the Web (PC/H5) This call is called
According to the specified search term, and search scope and other parameters, the search function of Tencent map products is adjusted, the location, address, bus search is initiated, and the search results are directly displayed on the map.
Note: bus search refers to bus route search. For example, search the information of route 110. If you want to search for a bus transfer scheme, use the route planning interface. Method name: search
Parameter names | mandatory | instructions | The sample |
---|---|---|---|
region | no | Restricted search cities | Beijing region = |
bound | no | Limited search coordinate range: rectangular range area, parameters should be given rectangular lower left (southwest) and upper right (northeast) position coordinates LAT, LNG < lower left >, LAT, LNG < upper right > | Bound = 39.907293, 116.368935, 39.914996, 116.372 |
coord_type | no | The value can be: 1. GPS 2. Tencent coordinates (default) If a user sets this parameter as a non-Tencent map coordinate system, the URI API will automatically process the coordinates to accurately map to the Tencent map base map. | coord_type=1 |