i have array of lat long like :
var locationList = new Array( '23.2531803, 72.4774396', '22.808782, 70.823863', '24.3310019, 72.8516531', '22.3073095, 73.1810976', '22.3038945, 70.8021599', '23.850809, 72.114838' );
i want get nearest around 25 km ‘s lat long from first given array which is 23.2531803, 72.4774396
are there any calculation for nearest 25 km ‘s lat long from given array.
NOTE: for some reason i can not use sql query, because i get lat long from given address
Step 1: Calculate the distance between your start coordinate and every subcoordinate
Step 2: Pick the smallest distance
Step 3: Is it < 25 km? Success!
How to calculate distance between two coordinates:
This function thinks of the Earth as a perfect ball, which it is not – slight variations do apply, but are neglible at the 25km diameter you want.