I recently posted a thread asking how i could claculate the distance between two places using map co-ordinates and i recieved this very helpful answer.
You can use this line (your code will need to calculate $distance_across and $distance_up):
$distance = sqrt($distance_across*$distance_across + $distance_up*$distance_up);
my only problem now is how to calculate $distance_across and $distance_up what data do i use and how do i use it.
Any help would be greatly appreciated
It depends on the format your map co-ordinates are in. If they are just simple numbers, you can use:
$distance_across = abs($x1 - $x2);
$distance_up = abs($y1 - $y2);
This requires you to have the two co-ordinates as pairs of numbers ($x1, $y1 and $x2, $y2). If your map data is in a different format (e.g. letters) you will need to convert it first.
Thanks guys you have been really helpful
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)