[mapguide-users] Calculating a Euclidean Distance in Javascript
nclayton
nclayton at gmail.com
Tue May 20 15:27:18 EDT 2008
I'm trying to reproduce the function being called in php to measure the
distance between the two points of the measure tool in javascript so that I
can display the current distance while a user is picking a second point on
the map. So far the formula I have tried is not producing the same result as
the result of
$srsMap->MeasureEuclideanDistance($x1,$y1,$x2,$y2) in measure.php
the formula I am trying is:
distance = sqrt(abs(x2 - x1)^2 + abs(y2-y1)^2)
then to convert to miles:
miles = distance * 0.000621371192
Thanks in advance for any input.
--
View this message in context: http://www.nabble.com/Calculating-a-Euclidean-Distance-in-Javascript-tp17348713p17348713.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list