[postgis-users] Find polygone withiin a distance of a point

antonys at nsom.org.uk antonys at nsom.org.uk
Tue Aug 2 08:30:03 PDT 2011


Hi
 
I'm creating a web page where the user enters a point (Longitude & Latitude) and
a distance in KM (Either 0 - 5)
I need to return from the Postgis Database all the polygone(s) within the set
distanance of seid point. and return attributs from another table
 
so this is kind of what i've come up with
 
select a.coll_a,a,coll_b,p.coll_a from attributes a,polys p where a.coll_a =
p.coll_a and ST_DWithin(p.the_geom, ST_GeomFromText('POINT(MyPoint)'4326), D) 
 
where MyPoint is theLongitude & Latitude entered and D the distance * 1000
 
A will this work?

is there a simpler way?
 
btw the polygone SRID is also 4326 (WGS84)
 
Thanx

 
Tony

The future has a bearing on the past but did the past take into account the
future
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110802/61042842/attachment.html>


More information about the postgis-users mailing list