[postgis-users] How to Lookup Nearest Locations from a Table

Shlomi Fish shlomif at iglu.org.il
Mon Dec 20 07:13:50 PST 2010


On Thursday 16 December 2010 18:13:37 Fabio Renzo Panettieri wrote:
> On Thu, 2010-12-16 at 18:05 +0200, Shlomi Fish wrote:
> > Hi all.
> > 
> > We have a table with a geography column. We'd like, for any given row, to
> > return the N nearest *other* rows.  We saw ST_Distance, but is that the
> > only approach? It feels like it will be slow and will not scale well.
> > 
> > Is there anything more magical to use? We're pretty new to PostGIS.
> 
> Probably using this ST_DWithin + Limit N
> http://www.postgis.org/docs/ST_DWithin.html

Thanks, though when using ST_DWithin we run the risk of getting too few 
results if the rows are too sparse.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

Chuck Norris can make the statement "This statement is false" a true one.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



More information about the postgis-users mailing list