Date: Thu, 25 Feb 2010 11:56:05 -0500
Reply-To: "Adam B. Troy" <abtphd@GMAIL.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Adam B. Troy" <abtphd@GMAIL.COM>
Subject: Lat/Long Distance Calculation Syntax
I'm trying to refine a syntax to calculate the distance between a pair of
latitude/longitudes. The syntax below is from Ray Levesque's site, but as
the distance between points increases, the error of the calculation greatly
increases, often undestimating by hundreds of miles as the distance exceeds
1000+ miles. I am using decimal degree formats (e.g., lat 40.852931; long
-74.109250 ). Any info would be greatly appreciated to increase the
accuracy of this calculation. --Adam
compute theta = long2 - long1.
compute d1 = (sin((artan(1)/45)*(lat2)) * sin((artan(1)/45)*(lat1))) +
(cos((artan(1)/45)*(lat2)) * cos((artan(1)/45)*(lat1)) *
if range(d1,-1,1) d2 = 2*artan(1) - arsin(d1) .
compute d3 = (45/artan(1))*(d2).
compute distmile = d3 * 60 * 1.1515 .
compute distkm = distmile * 1.609344.