If you would like to get distance between two places with mysql query. You can use below query to find air distance between two places.
Example :: Suppose you want to get air distance between all employee's home and office location.
To run this query you need to have latitude and longitude of your office and all employee's address. If you don't have latitude and longitude you can find from Google or Bing map API.
$office_latitude = 30.365315;
$office_longitude = 78.088266;
select (((acos(sin(($office_latitude*pi()/180)) * sin((employee.latitude*pi()/180))+cos(($office_latitude*pi()/180)) * cos((employee.latitude*pi()/180)) * cos((($office_longitude - employee.longitude)* pi()/180))))*180/pi())*60*1.1515) as distance from employee
0 Comment(s)