|
Posted by Mitul on 09/28/48 11:41
Hello friend,
I hope that following function will helpful to your. This function will
use to calculate circular distance
function Calculate_distance($lat1, $lon1, $lat2, $lon2) {
$theta = $lon1 - $lon2."<br>";
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +
cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
return $miles = round($dist * 60 * 1.1515);
}
With Regards,
Mitul Patel
mitul [at] siliconinfo [dot] com
Navigation:
[Reply to this message]
|