steve enzer wrote:
I'm facing a similar issue; a huge postgis database with a point
column, trying to find a clean query to bring back the nearest n
results to a point.  Why isn't that easy? Or is it?

The problem is that the nearest n points is not well defined in spatial terms. For example think about the difference between rural Wyoming and downtown Manhattan!

Typically to make a query fast you need to use and index and that means you need a bounding box that specifies your search distance. But the bbox that is good for Manhattan may be too small for Wyoming.

One strategy is to search at a given small radius and see if you have enough results, if not double the search radius and redo the query. While this may seem costly, it is in fact very fast because postgresql is very good at caching results and pages in memory.

Hope this helps,
  -Steve

I'm using georuby and spatial adapter.

Steve

On Thu, Jul 23, 2009 at 10:01 AM, Jeff Davis<pg...@j-davis.com> wrote:
On Thu, 2009-07-23 at 08:58 -0700, Paul Ramsey wrote:
Hopefully GEOGRAPHY will retire all these requirements once and for
all :)
Is that something under development? I'm new to these lists, so I
haven't been following.

Regards,
       Jeff Davis

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to