[postgis-users] Returning polygons if any of a polygon input points lie in the polygons

Hugues François hugues.francois at irstea.fr
Tue Nov 18 00:00:45 PST 2014


Hello,

 

Maybe I don’t understand your problem very well but I think your query for points should work with a polygon using ST_GeomFromText (http://www.postgis.org/docs/ST_GeomFromText.html) for your input polygon or a subquery if it stored into your DB.

 

Hugues.

 

De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Joseph Spenner
Envoyé : lundi 17 novembre 2014 22:35
À : PostGIS Users Discussion
Objet : [postgis-users] Returning polygons if any of a polygon input points lie in the polygons

 

Hello, I'm trying to perform a query which will return any polygons which have any points in common with an input polygon.

 

So, if I have Polygon A.

In my database, I have several other polygons stored.

 

I want to submit a query with Polygon A as the input, which will return all of the polygons in my database which have any points in common with Polygon A.

 

Can this be done?


I found this:

http://postgis.net/docs/ST_Overlaps.html

 

But from what I can tell, it only returns a T or F.   I need to fetch the actual polygons if T.

 

I'm currently able to query with points as input:

 

select zone,gid,state,name,ST_Asgeojson( geom ) from polys where ST_Intersects(ST_PointFromText('POINT(-109 42)', 4269), geom);





But now I have a need to use polygons as input.





Any help would be great.





Thanks!

 

Regards,

Joseph Spenner

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20141118/99375648/attachment.html>


More information about the postgis-users mailing list