Search Postgresql Archives

Re: earthdistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I did not found any geographic indexing with earthdistance, and need it.

The need I have is simple:
"is the distance between two (lat,long) positions less than X km?"
the model used for the shape of the earth should be related to the precision of lat,lon, and most sources are imprecise. The spherical model should be enough.

How wrong I am to think that:
* postgres contains a circle object where distance is the hypothenuse. The spherical problem using lat,long is also bidimensional. We could /just use haversine distance instead of hypothenuse.
* gist and b-tree bidimensional indexing does not need to be changed to fulfill this need.


 


2013/8/10 Uwe Schroeder <uwe@xxxxxxxxx>

 

How accurate do you need it? My website has a lot of "local" listing stuff based on a distance from the viewer and I use the earthdistance module in contrib to do it.

Given, it's not accurate enough to calculate a surgical missile strike, but for "within 20 miles" type of things it's good enough - give or take a mile.

 

The problem I have is to determine the location of the viewer/poster. Aside from asking precice lat/long coordinates (which no user will have any clue about), the next best thing is to rely on smartphones and their GPS - but what of regular browser/computer users? When I let google map my location it shows as San Francisco - which is about 56 miles off. So network location makes no sense for this.

I'm using a zipcode based geographical mapping, which already has flaws since a zipcode is an area, not a point. The commonly available zipcode databases give you the geographical center of the zipcode - which certainly will be some distance off from the real location.

 

I found that the inaccuracies work for my application - nobody cares about a few more or less miles when looking for something. The advantage is that it also protects the privacy of the poster to some degree - nobody really needs to know exactly where the post originated...

 

If "openbarter" is what I think it is (kinda craigslist just with bartering), I think a few miles off won't make a difference. Chances are, your members won't divulge their true location anyways. We have members from South Africa using a US zipcode - which is what ... 5000 miles off?

Earthdistance is definitely easy to deal with - just give a latitude/longitude and off you go..

 

Uwe

 

 

 

 

On Fri, 08/09/2013 09:29:49 PM Olivier Chaussavoine wrote:

I develope a project openbarter that needs to match objects based on a maximum distance between their positions on earth. I saw that the documentation of the extension earthdistance was interesting, but the promise was not in the code. It would  be nice to have these functions available independently of sophisticated geographic systems. There is a circle object for flat two dimensional space, but earth deals with spherical caps. It would not be exact but enough to suppose that earth is a sphere and that all dimensions latitude, longitude and distance are in radian.
What would need to be done to adapt the circle type to a new type 'spherical cap' that would allow simple geographic indexing?

--
Olivier Chaussavoine






--
Olivier Chaussavoine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux