Re: Advice on geolocation
От | Chris Albertson |
---|---|
Тема | Re: Advice on geolocation |
Дата | |
Msg-id | 20020726190744.30535.qmail@web14703.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: Advice on geolocation (Bruno Wolff III <bruno@wolff.to>) |
Список | pgsql-general |
--- Bruno Wolff III <bruno@wolff.to> wrote: > On Fri, Jul 26, 2002 at 09:33:53 -0700, > Chris Albertson <chrisalbertson90278@yahoo.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@yahoo.com Cell: 310-990-7550 Office: 310-336-5189 Christopher.J.Albertson@aero.org __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com
В списке pgsql-general по дате отправления: