Is there a list of merchants:
A latitude, longitude 28.24529:112.94134
B latitude, longitude 28.25529:112.95134
C latitude, longitude 28.26529:112.96134
D latitude, longitude 28.27529:112.97134
E latitude, longitude 28.28529:112.98134
F latitude, longitude 28.29529:112.99134
.
How to get away from the current position from the list of merchants recent business information
CodePudding user response:
//calculate the points and the distance from the current positioningShort: function (la1, lo1 la2, lo2) {
Var La1=La1 * Math. PI/180.0;
Var La2=La2 * Math. PI/180.0;
Var La3=La1 - La2;
Var 5=lo1 * Math. PI/180.0 - lo2 * math.h PI/180.0;
Var s=2 * math.h asin (math.h SQRT (math.h pow (Math. Sin (La3/2), 2) + math.h cos (La1) * Math. Cos (La2) * math.h pow (Math. Sin (5/2), 2)));
S=s * 6378.137;//the earth radius
S=Math. Round (s * 10000)/10000;
Return s.t oFixed (1) + 'km;
}
CodePudding user response:
Thank you for your advice, you let me know the calculation of the distance between two points, I want to, like my cooperation business table has 1000 business positioning, again according to the user's current location, get the nearest businesses, many small programs, or apps have this function, don't know how to achieve better, if the position of each merchants and calculate again to compare the current position and will not too big amount of calculation,CodePudding user response:
Thanks for sharing the original poster