[mapguide-users] Calculating a Euclidean Distance in Javascript
Andrew DeMerchant
andrew.demerchant at gemtec.ca
Thu May 22 09:25:47 EDT 2008
It's either a pretty interesting coincidence that 23.529 / 77.196 =
0.3048, or else it's a units problem you've got (feet vs meters). 1 foot
= 0.3048m.....
Andrew
nclayton wrote:
> 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.
>
--
*Andrew DeMerchant*
*Computer Technologist*
ph.1-877-2GEMTEC x.163
fax 506-453-9470
/GEMTEC Limited <http://www.gemtec.ca>
/191 Doak Road
Fredericton, NB, Canada
E3C 2E6
-------------- next part --------------
Skipped content of type multipart/related
More information about the mapguide-users
mailing list