Click to See Complete Forum and Search --> : Map Co-Ordinates


Henrycoffin
06-17-2003, 05:23 AM
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


Thanks

AdamGundry
06-17-2003, 07:03 AM
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.

Adam

Henrycoffin
06-17-2003, 07:49 AM
Thanks guys you have been really helpful:)