Re: Querying distances between two coordinates

From: Jeremy <jeremy0505_at_gmail.com>
Date: Sat, 11 Jun 2011 18:44:59 +0100
Message-ID: <MPG.285db9f75ab6317398990f_at_News.Individual.NET>



In article <6ff6734c-6844-439b-a65e-48ebb4a54056 _at_f2g2000yqh.googlegroups.com>, hooperc2001_at_gmail.com says...
>
> 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!

Many thanks. The "real" question is more about how one actually queries the db ("radius search") efficiently - this was step 1 in understanding some basics ;)

-- 
jeremy
Received on Sat Jun 11 2011 - 12:44:59 CDT

Original text of this message