I usually use haversine's formula to calculate the distance between two
points (based on lat.-long. coords.):
 
<CFSET distance =
#Evaluate(((pi()*3969.96)/180)*(ACos((Sin(lat_A)*Sin(lat_B)) +
(Cos(lat_A)*Cos(lat_B)*Cos(lon_A-lon_B)))))#>
 
 ~Simon

Simon Horwith
Allaire Certified Instructor
Certified ColdFusion Developer
Fig Leaf Software
1400 16th St NW, # 500
Washington DC 20036
202.797.6570 (direct line)
www.figleaf.com



-----Original Message-----
From: Sharon DiOrio [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 9:34 AM
To: CF-Community
Subject: Re: longtitude and latitude


It can be done.  In fact, if you're only measuring Longitude, it's a simple
matter of multiplying the difference between the two numbers times the
constant 111.3 (the number of miles in a degree).  (Keep in mind that the
constant actually varies from 110.57 to 111.32 as the latitude gets closer
to the equator.  You can probably find some kind of table on the web for
exact constants.)

If you're dealing with longitude *and* latitude, then you'll need to think
back to the Pythagorean Theorum (A^2 * B^2 = C^2) to triangulate distances
returned in degrees, which you can then mulitiply by the constant.

(I finally figured out when I'd use that High School math again...)

Sharon

At 12:07 PM 3/15/2001 +0000, John McCosker wrote:
>Maybe, or maybe not, a cf question but I feel the audience is of the right
>kaliber of intelligence to be asking anyway!!
>
>I'm working with Longtitude and latitude co-ordinates at the moment,
>
>what I would like to do is work out the differnce in Kilometers (or miles)
>between two references i.e.
>
>Lontitude 5.48084768538759  and longtitude -5.9417692388158496
>
>I am pulling both co-ordinates from a cfquery and then setting a zoom level
>with a centre point depending on the distance between the two points.
>
>Any help on this matter would be appreciated....
>
>Thank you
>
>JMC
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to