
Calculate north-south distance:

    Y = latitude A - latitude B

Calculate east-west distance:

    X = longitude A - longitude B

Adjust east-west distance for latitude

    XA = X * cos(latitude A)

Calculate total distance:

    D = square root ((XA * XA) + (Y * Y))

Notes:

1.  The distances in these formulas are expressed in degrees of
    latitude along the surface of the Earth, so one degree is
    equivalent to roughly 69 miles.

2.  For calculating the cosine function, you have several options:
    A) Write your program in a HLL and use its library function,
    B) Use a table lookup or some other simple approximation.  C)
    If you know that you will always be operating within a narrow
    range of latitudes, consider simply using a constant for
    cos(latitude A).

3.  If you are only interested in finding the closest object, and
    don't care about the actual distances, you don't have to
    compute the square root in the last step.  Just calculate the
    value ((XA * XA) + (Y * Y)) for each case and compare those
    results to find the closest object.

-- Russ
