[mapguide-users] Calculating a Euclidean Distance in Javascript

nclayton nclayton at gmail.com
Thu May 22 09:33:51 EDT 2008


I think you just solved the problem...I am using US Survey Feet as my
coordinate system.

So if this is truely the case and not a coincidence, then I don't have to
recalculate to feet because it's already there. I'll try that and see what I
get.

Thanks for the input!


andrew.demerchant wrote:
> 
> 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
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Calculating-a-Euclidean-Distance-in-Javascript-tp17348713p17404339.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list