[postgis-users] Points within range of line

Stephen Woodbridge woodbri at swoodbridge.com
Thu Aug 11 14:24:35 PDT 2005


Adrian,

This is probably much faster, especially if the line is complex, and it 
uses a spatial index on the point_table is you build one where the_geom 
is the geometry column for the points and "dist" is the distance you 
want and line is the line geometry.

select * from point_table where expand(the_geom, dist) && line and 
distance(the_geom, line) < dist;

-Steve
  http://imaptools.com

Adrian Holovaty wrote:
> Given a PostGIS-enabled table of points, what's the best way to retrieve all 
> the points that are within a certain distance of a given line? The line can 
> have an arbitrary number of points (i.e., it's not straight).
> 
> Surely this is a solved problem. Thanks for any help -- I'm still 
> learning! :-)
> 
> Adrian
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list