Documente Academic
Documente Profesional
Documente Cultură
Microsoft Access Tips & Tricks: Great Circle Distance | The Blogannath Rolls On . . .
M O ND A Y, A P R I L 1 2 , 2 0 1 0
be the differences in latitude and longitude respectiv ely between the two points. The distance between them is
, which represents the angular distance between the points subtended at the center of the sphere. The actual distance
, where r is the radius of the sphere.
In the case of the earth, r is 637 1 .01 km, 3958.7 6 statute miles or 3440.07 nautical miles.
The most common formula one encounters is called the ArcCosine formula. It calculates
as below:
Unfortunately , this formula has large rounding errors when the distances are v ery small, so it is not commonly used. One of the alternativ es to the
ArcCosine formula is the Hav ersine formula below:
Although this formula is accurate for most distances, it too suffers from rounding errors for the special (and somewhat unusual) case of antipodal
points (on opposite ends of the sphere). A more complicatedformula that is accurate for all distances is the following special case (a sphere, which is an
ellipsoid with equal major and minor ax es) of the V incenty formula (which more generally is a method to compute distances on ellipsoids):
http://blogannath.blogspot.com.au/2010/04/microsoft-access-tips-tricks-great.html
1/4
4/15/2015
Microsoft Access Tips & Tricks: Great Circle Distance | The Blogannath Rolls On . . .
In this post, I will prov ide code for V BA functions that implement each of these formulae to calculate the great circle distance between any two points,
whose coordinates are passed into these functions as arguments. Y ou can compare the performance of these functions against each other and use
whichev er one suits y our purpose best. In most cases, they will come up with the ex act same answer, so it is only a matter of preference which one is
chosen. But giv en the cav eat about errors in v ery short distances when using the ArcCosine formula, and the complex ity of the V incenty formula, I
prefer the Hav ersine formula.
Notice that Microsoft Access lacks functions for ArcCos() and ArcSin(), and therefore these quantities hav e to be deriv ed using other trigonometric
functions av ailable in Access. Therefore I will prov ide these functions first before I go on to the functions for the distance. Those functions for distance
will use the ArcCos and ArcSin functions below. The ArcCos and ArcSin functions are written based on the trigonometric identities below:
ArcCos(X) = ArcTan(-X / (-X * X + 1)) + 2 * ArcTan(1)
Arcsin(X) = ArcTan(X / (-X * X + 1))
http://blogannath.blogspot.com.au/2010/04/microsoft-access-tips-tricks-great.html
2/4
4/15/2015
Microsoft Access Tips & Tricks: Great Circle Distance | The Blogannath Rolls On . . .
http://blogannath.blogspot.com.au/2010/04/microsoft-access-tips-tricks-great.html
3/4
4/15/2015
Microsoft Access Tips & Tricks: Great Circle Distance | The Blogannath Rolls On . . .
http://blogannath.blogspot.com.au/2010/04/microsoft-access-tips-tricks-great.html
4/4