Nearest neighbor, as Stephen notes in the followup is not something
that is necessarily easy in general. However! Another development
on-stream for PostgreSQL 8.5 will allow us to both (a) use k-d tree
indexes for points, which are much more efficient and (b) to do
nearest-neighbor searching using the index tree, which will be a great
deal more optimal for general cases.

However, those changes are a good 9 months out (we need new PgSQL
release *and* new PostGIS release to leverage it). In the meanwhile,
an iterative box that doubles until it finds something is your best
bet. There should be examples in the wiki, it's not an uncommon
question.

P

On Thu, Jul 23, 2009 at 11:19 AM, steve enzer<steve.en...@gmail.com> 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?
>
> 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