# Re: Querying distances between two coordinates

From: Charles Hooper <hooperc2001_at_gmail.com>
Date: Fri, 10 Jun 2011 16:42:42 -0700 (PDT)

On Jun 10, 6:00 pm, Mladen Gogala <n..._at_email.here.invalid> wrote:
> The easiest way is to assume that the Earth is flat. In that case, you
> have Pythagorean theorem and linear algebra. If anyone tries to
> contradict, they should expect the Spanish inquisition. I know that
> nobody expects Spanish inquisition whose primary weapons are....

I found the lesson plan. I see that part of the point of the lesson was to destroy Euclid's Elements, which were introduced 23 centuries ago. :-)

Even though the lesson plan is 3 pages long, the details are a little sketchy. Distance in miles:
c0 = cos^-1*(cos(90-alpha1)*cos(90-alpha2) + sin(90-alpha1)*sin(90- alpha2)*cos(theta1-theta2))
distance = c0 * (2pi/360) * 3960 miles

The above appears to be similar to one of the Excel formulas found on the webpage that I referenced:
=ACOS(SIN(lat1)*SIN(lat2)+COS(lat1)*COS(lat2)*COS(lon2-lon1))*6371 KM

My notes state that it is important to use radian measurements because those measurements have a direct correspondence with arc distances.

For verification:
Prague (14 degrees 26 minutes east, 50 degrees 5 minutes north) Rio de Janeiro (43 degrees 12 minutes west, 22 degrees 57 minutes south)
= 6152 miles

(119 degrees 48 minutes west, 36 degrees 44 minutes north) (88 degrees 30 minutes west, 42 degrees south) = 5789.38 miles

Wow, I sure have forgotten a lot of math!

```---
The proof of 1=2 is on my blog.

Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration
from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.
```
Received on Fri Jun 10 2011 - 18:42:42 CDT

Original text of this message