[mapguide-users] Calculating a Euclidean Distance in Javascript

nclayton nclayton at gmail.com
Thu May 22 09:21:57 EDT 2008


Hmmm...something's not lining up right.

Here are my test values:

Start Point
x1 = 782968.222103
y1 = 1774880.116909

End Point
x2 = 783044.338
y2 = 1774867.244367

I used this formula in php:

$distance = sqrt(pow($x1 - $x2,2.0) + pow($y1 = $y2,2.0))

This gave me a value of 77.19671051057

$srsMap->MeasureEuclideanDistance($x1,$y1,$x2,$y2) gave me 23.529604265472

It looks like I'm using the same formula, but I am getting a dramatically
different result.
-- 
View this message in context: http://www.nabble.com/Calculating-a-Euclidean-Distance-in-Javascript-tp17348713p17404134.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list