Re: Advice on geolocation

From: Chris Albertson <chrisalbertson90278(at)yahoo(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Advice on geolocation
Date: 2002-07-26 19:07:44
Message-ID: 20020726190744.30535.qmail@web14703.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


--- Bruno Wolff III <bruno(at)wolff(dot)to> wrote:
> On Fri, Jul 26, 2002 at 09:33:53 -0700,
> Chris Albertson <chrisalbertson90278(at)yahoo(dot)com> wrote:
> >
> > I've done quite a bit of this as I used to work on a GIS
> > product. Given to lat,lon pairs it is not hard to find
> > the great circle distance between them. This assumes a
> > spherical Earth but good enough for your purposes as the
> > error will be under a few hundred meters
>
> My concern about this is that it will not be indexable. I suspect,
> but don't
> know, that this won't really be an issue for the small number (~5000)
> points
> of data (especially since I expect other constraints to be used in
> most
> queries).

The way I handle the non-indexable problem in an astronomical
database the has tens of millions of stars in it is to fist
make a crude querry. I SELECT all stars in a "box" then apply
the great circle method only to those. For example if you
wanted to find evey point within 500 miles of some point first
assume a flat Earth and assume each degree equals 60 miles.
This will give you to many hits but you only need to apply
the more exact method to a small subset of the data.
For many purposes (say within a couple hundred miles.)
the "flat Earth" model is good enough if you assume degrees of
latitude = 60 miles and degrees of long. = cos(lat)*60 mile
per degree. then simply use 60*sqrt(lat^2+long2) to
compute the distance (60 is for nautical miles can't
remember the stature mile conversion right now.)

For bigger distances like USA to Japan you really do need
the great circle method. BUt "flat Earth" works for inside the
same city

=====
Chris Albertson
Home: 310-376-1029 chrisalbertson90278(at)yahoo(dot)com
Cell: 310-990-7550
Office: 310-336-5189 Christopher(dot)J(dot)Albertson(at)aero(dot)org

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Albertson 2002-07-26 19:15:06 Re: 1 milion data insertion
Previous Message Elielson Fontanezi 2002-07-26 18:58:48 The best book