Distance using Latitude and Longitude
Date: 12/31/97 at 11:28:30 From: Brian K. Reed Subject: Distance using Lat and Long ? Hi! Is there a simple formula for calculating distance using known latitude and longitude? Thanks in advance, Brian Reed Senior Research Analyst Booz*Allen & Hamilton
Date: 12/31/97 at 11:35:28 From: Doctor Rob Subject: Re: Distance using Lat and Long ? Yes. Assume the Earth is a perfect sphere. Let all angles be measured in degrees. If the latitude is North, let phi = 90 - latitude. If the latitude is South, let phi = 90 + latitude. The North Pole has phi = 0, the South Pole has phi = 180, and 0 <= phi <= 180. If the longitude is East, let theta = longitude. If the longitude is West, let theta = -longitude. Greenwich, England, has theta = 0, and -180 <= theta <= 180. Let the angles for the two points be (phi1, theta1) and (phi2, theta2). Then compute c = sin(phi1)*sin(phi2)*cos(theta1-theta2) + cos(phi1)*cos(phi2). Then the shortest great circle distance between the two points is d = R*Arccos(c)*Pi/180, where R is the radius of the earth in miles, and the arccosine is taken between 0 and 180 degrees, inclusive. -Doctor Rob, The Math Forum Check out our web site! http://mathforum.org/dr.math/
Date: 12/31/97 at 11:56:20 From: Reed Brian Subject: RE: Distance using Lat and Long ? Thanks! This is just what I need! Regards, Brian
Date: 11/16/98 at 12:45:35 From: Tom Reilly Subject: Wrong formula The answer from Dr. Rob to a student's question posting [see below] has an incorrect formula. c = sin(phi1)*sin(phi2)*cos(theta1-theta2) + cos(phi1)*cos(phi2). should be: c = sin(phi1)*sin(phi2)+cos(theta1-theta2) * cos(phi1)*cos(phi2).
Date: 11/16/98 at 15:34:28 From: Doctor Rick Subject: Re: Wrong formula Hi, Tom. Did you notice the way Dr. Rob defined phi? If phi is simply the latitude (+ for north, - for south latitude), then your formula is correct - it is the formula I use. But Dr. Rob defined phi as 90 - lat for north latitudes (90 + lat for south latitudes). This definition switches sines and cosines, since sin(90-phi) = cos(phi) and cos(90-phi) = sin(phi). Dr. Rob defined phi this way because it is the standard way that spherical coordinates are defined. Admittedly it's a little confusing to those who are used to working with latitudes, but then, those who are NOT accustomed to latitude math are more likely to ask the question! Mistakes do sometimes make it into our archives, and we appreciate diligent readers who catch these errors. But I don't think we are wrong here. Keep looking! :-) - Doctor Rick, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.