Tencent service uses a small distance between the two positions is calculated (with source)

 

background:

In a recent small program development, it is necessary to calculate the distance between the current position to the target position. Backed "Tencent father", there is no reason not to use Tencent's location service ah! Taking advantage of the weekend to sort use it, also I wrote a demo, and share with you.

Sample use:

Enter the destination address, click on the button below to calculate the current location address how far from the target.

 

Steps for usage:

Below I will talk about the development steps, the details can be viewed in the source code, detailed code article no longer appears. Source link below.

Note: The source code without a key, the key needs its own application, the application quickly. Applet client does not appId, you can fill in your own .

1: application key. Tencent is the use of location services, after all, is a micro-channel applet people. This is the document addresses Tencent location services (https://lbs.qq.com/webservice_v1/index.html). You first need to apply for a key in the address, the call interface will be used. Individual developers and businesses are eligible to apply, not RMB players, limiting the number of free calls.

2: side applet acquired current coordinate information and destination address information is transmitted to the background, the background to the coordinate information acquired by the target address of an interface.

3: The coordinate information of the current position information and the target address returned by the first interface through a second interface to request, to acquire the distance between the two coordinates.

Is not it simple! ! !

Source Address:

Address 1  https://www.xuhongchang.com/resource/download.html

Address 2  https://download.csdn.net/download/love1793912554/11343589

Published 21 original articles · won praise 18 · views 7572

Guess you like

Origin blog.csdn.net/love1793912554/article/details/95762129