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

Fabio Renzo Panettieri fpanettieri at xoomcode.com
Thu Dec 16 08:13:37 PST 2010


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

-- 
Fabio R. Panettieri
Lead Software Engineer
http://www.xoomcode.com 




More information about the postgis-users mailing list