Calculation of precise distance--java based on two-point latitude and longitude
Baidu map pickup latitude and longitude coordinates: http://api.map.baidu.com/lbsapi/getpoint/index.html on the internet to see a lot of distance based on latitude and longitude of the code is not accurate, and I tested the latitude to adjust to the North Pole (lon=90) , Latitude does not change, the result is still so much distance. Let's look at some conventional computing methods .
1. What is this. This is the Pythagorean theorem.
2. And this, is the most conventional algorithm, you will find that the latitude is the same, but latitude one but change the value will be wrong.
3. The second algorithm is originally from the Google formula, I dare not say that the formula is wrong, but the distance is not the same as the Baidu map.
The main errors of these algorithms are as follows: 1. Ignoring that the earth is not a standard sphere, it is based on a standard sphere . 2. Ignores changes in latitude that can cause longitude distances so based on the cost of more than 10 minutes of transformation and logical realization finally distance and Baidu map exactly the same.
Baidu map pickup latitude and longitude coordinates: http://api.map.baidu.com/lbsapi/getpoint/index.html
Can first in the Baidu API to take out the coordinates, and then use the Baidu map ranging. Ensure the results are identical. Download source code address
Click to download