<html><body><div style="color:#000; background-color:#fff; font-family:garamond, new york, times, serif;font-size:14px"><div id="yui_3_16_0_1_1416322189684_26981"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB">Hugues:</span></div><div dir="ltr" id="yui_3_16_0_1_1416322189684_26918"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB"> Yes, you are quite right. The ST_Intersects does exactly what I need. Good stuff here.</span></div><div id="yui_3_16_0_1_1416322189684_26980" dir="ltr"><br><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB"></span></div><div id="yui_3_16_0_1_1416322189684_26935" dir="ltr"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB">Thanks again everyone for your patience! I probably should have tried a few more of these before posting.</span></div><div id="yui_3_16_0_1_1416322189684_26934" dir="ltr"><br><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB"></span></div><div id="yui_3_16_0_1_1416322189684_26938" dir="ltr"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB">Cheers!</span></div><div id="yui_3_16_0_1_1416322189684_26939" dir="ltr"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB">Joseph Spenner</span></div><div id="yui_3_16_0_1_1416322189684_26940" dir="ltr"><span class="" id="yui_3_16_0_1_1416322189684_26342" style="font-size:11.0pt;" lang="EN-GB"><br></span></div><div id="yui_3_16_0_1_1416322189684_26913"><span></span></div><div id="yui_3_16_0_1_1416322189684_26914"> </div><div id="yui_3_16_0_1_1416322189684_26929"><div id="yui_3_16_0_1_1416322189684_26931">If life gives you lemons, keep them-- because hey.. free lemons.
</div><br><br><div id="yui_3_16_0_1_1416322189684_26930">
<br>"~heart~ Sticker" fixer: http://microflush.org/stuff/stickers/heartFix.html
</div><br><br><div id="yui_3_16_0_1_1416322189684_26928">
<br></div></div><br> <div id="yui_3_16_0_1_1416322189684_26924" style="font-family: garamond, new york, times, serif; font-size: 14px;"> <div id="yui_3_16_0_1_1416322189684_26923" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1416322189684_26922" dir="ltr"> <hr id="yui_3_16_0_1_1416322189684_26927" size="1"> <font id="yui_3_16_0_1_1416322189684_27002" face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Hugues François <hugues.francois@irstea.fr><br> <b><span style="font-weight: bold;">To:</span></b> Joseph Spenner <joseph85750@yahoo.com>; PostGIS Users Discussion <postgis-users@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, November 18, 2014 8:52 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> RE: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons<br> </font> </div> <div id="yui_3_16_0_1_1416322189684_27003" class="y_msg_container"><br><div id="yiv6953499053"><style>#yiv6953499053 #yiv6953499053 --
_filtered #yiv6953499053 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv6953499053 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv6953499053 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv6953499053 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
_filtered #yiv6953499053 {font-family:Garamond;panose-1:2 2 4 4 3 3 1 1 8 3;}
#yiv6953499053
#yiv6953499053 p.yiv6953499053MsoNormal, #yiv6953499053 li.yiv6953499053MsoNormal, #yiv6953499053 div.yiv6953499053MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv6953499053 a:link, #yiv6953499053 span.yiv6953499053MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv6953499053 a:visited, #yiv6953499053 span.yiv6953499053MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv6953499053 p.yiv6953499053MsoAcetate, #yiv6953499053 li.yiv6953499053MsoAcetate, #yiv6953499053 div.yiv6953499053MsoAcetate
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv6953499053 span.yiv6953499053EmailStyle17
{color:#1F497D;}
#yiv6953499053 span.yiv6953499053TextedebullesCar
{}
#yiv6953499053 .yiv6953499053MsoChpDefault
{font-size:10.0pt;}
_filtered #yiv6953499053 {margin:70.85pt 70.85pt 70.85pt 70.85pt;}
#yiv6953499053 div.yiv6953499053WordSection1
{}
#yiv6953499053 </style><div id="yui_3_16_0_1_1416322189684_27006"><div id="yui_3_16_0_1_1416322189684_27005" class="yiv6953499053WordSection1"><div id="yui_3_16_0_1_1416322189684_27004" class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB">Hi,</span></div><div class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1416322189684_27008" class="yiv6953499053MsoNormal"><span id="yui_3_16_0_1_1416322189684_27007" style="font-size:11.0pt;" lang="EN-GB">I think ST_Intersects will meet your needs :</span></div><div class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1416322189684_27010" class="yiv6953499053MsoNormal"><span id="yui_3_16_0_1_1416322189684_27009" style="font-size:11.0pt;" lang="EN-GB">SELECT zone,gid,state,name,ST_Asgeojson( geom ) </span></div><div class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB">FROM polys </span></div><div id="yui_3_16_0_1_1416322189684_27012" class="yiv6953499053MsoNormal"><span id="yui_3_16_0_1_1416322189684_27011" style="font-size:11.0pt;" lang="EN-GB">WHERE ST_Intersects(ST_GeomFromText('POLYGON((-109 42,-108 42, -108 43; -109 43, -109 42))', 4269), geom)</span></div><div id="yui_3_16_0_1_1416322189684_27013" class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1416322189684_27014" class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB">Hugues.</span></div><div id="yui_3_16_0_1_1416322189684_27015" class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1416322189684_27016" class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;" lang="EN-GB"> </span></div><div><div class="yiv6953499053MsoNormal"><b><span style="font-size:10.0pt;">Hugues François</span></b><b><span style="font-size:10.0pt;color:black;"></span></b></div><div class="yiv6953499053MsoNormal"><span style="font-size:10.0pt;">Tourisme et systèmes d’information</span><span style="font-size:13.5pt;color:black;"></span></div><div class="yiv6953499053MsoNormal"><span style="font-size:10.0pt;">Irstea – DTM</span></div><div class="yiv6953499053MsoNormal"><span style="font-size:13.5pt;color:black;"> </span></div><div class="yiv6953499053MsoNormal"><span style="font-size:10.0pt;">+33 </span><span style="font-size:10.0pt;">(</span><span style="font-size:10.0pt;">0</span><span style="font-size:10.0pt;">)</span><span style="font-size:10.0pt;">4.76.76.27.44</span><span style="font-size:13.5pt;color:black;"></span></div><div class="yiv6953499053MsoNormal"><span style="font-size:10.0pt;">+33 </span><span style="font-size:10.0pt;">(</span><span style="font-size:10.0pt;">0</span><span style="font-size:10.0pt;">)</span><span style="font-size:10.0pt;">6.77.66.21.31</span><span style="font-size:13.5pt;color:black;"></span></div></div><div class="yiv6953499053MsoNormal"><span style="font-size:11.0pt;"> </span></div><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;"><div class="yiv6953499053MsoNormal"><b><span style="font-size:10.0pt;">De :</span></b><span style="font-size:10.0pt;"> postgis-users-bounces@lists.osgeo.org [mailto:postgis-users-bounces@lists.osgeo.org] <b>De la part de</b> Joseph Spenner<br clear="none"><b>Envoyé :</b> mardi 18 novembre 2014 16:44<br clear="none"><b>À :</b> PostGIS Users Discussion<br clear="none"><b>Objet :</b> Re: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span></div></div></div><div class="yiv6953499053MsoNormal"> </div><div class="qtdSeparateBR"><br><br></div><div class="yiv6953499053yqt3690255559" id="yiv6953499053yqt04617"><div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16747"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Something I did notice though-- it seems that if the input polygon completely surrounds a polygon stored in my database, it is not included in the result. I read something about this here: <a rel="nofollow" shape="rect" id="yiv6953499053yui_3_16_0_1_1416322189684_17135" target="_blank" href="http://postgis.net/docs/ST_Overlaps.html">http://postgis.net/docs/ST_Overlaps.html</a></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17103"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17081"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> "<b id="yiv6953499053yui_3_16_0_1_1416322189684_17101"><i id="yiv6953499053yui_3_16_0_1_1416322189684_17100">Returns TRUE if the Geometries "spatially overlap". By that we mean they intersect, but one does not completely contain another.</i></b>"</span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17082"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17083"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">I do need the polygons which are completely contained as well. Can this be done?</span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17085"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17099"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks again for the help. I'm getting there!</span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17098"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17086"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Regards,</span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17097"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Joseph Spenner</span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17087"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16748"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16742"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16749"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div></div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16752"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16751"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16750"><div class="yiv6953499053MsoNormal" style="text-align:center;background:white;" align="center"><span style=""></span><hr align="center" size="1" width="100%"></div><div class="yiv6953499053MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;">From:</span></b><span style="font-size:10.0pt;"> Joseph Spenner <<a rel="nofollow" shape="rect" ymailto="mailto:joseph85750@yahoo.com" target="_blank" href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>><br clear="none"><b>To:</b> Rémi Cura <<a rel="nofollow" shape="rect" ymailto="mailto:remi.cura@gmail.com" target="_blank" href="mailto:remi.cura@gmail.com">remi.cura@gmail.com</a>>; PostGIS Users Discussion <<a rel="nofollow" shape="rect" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>> <br clear="none"><b>Sent:</b> Tuesday, November 18, 2014 8:35 AM<br clear="none"><b>Subject:</b> Re: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16754"><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div><div id="yiv6953499053"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16756"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16755"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14848"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;">Rémi:</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14857"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> Yes, that worked perfectly. Thanks!</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14888"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;"> My input poly will be stored in another database (maybe just another table). It would be nice to perform the query all on 1 line (get the poly and use it for the query), but I can query the first table first to get the input poly, then use that for the 2nd query without too much difficulty.</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14887"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;"><br clear="none">Thanks again for the responses!</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14886"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14858"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;">Regards,</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14885"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.0pt;">Joseph Spenner</span><span style="font-size:10.5pt;"></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14884"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14834"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14836"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14835"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">If life gives you lemons, keep them-- because hey.. free lemons. </span></div></div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;"> </span></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14837"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"><br clear="none">"~heart~ Sticker" fixer: <a rel="nofollow" shape="rect" target="_blank" href="http://microflush.org/stuff/stickers/heartFix.html">http://microflush.org/stuff/stickers/heartFix.html</a> </span></div></div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;"> </span></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14838"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div></div></div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span></div><div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;"> </span></div></div><div id="yiv6953499053yqt68408"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14842"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14841"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14840"><div class="yiv6953499053MsoNormal" style="text-align:center;background:white;" align="center"><span style=""></span><hr align="center" size="1" width="100%"></div><div class="yiv6953499053MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;">From:</span></b><span style="font-size:10.0pt;"> Rémi Cura <<a rel="nofollow" shape="rect" ymailto="mailto:remi.cura@gmail.com" target="_blank" href="mailto:remi.cura@gmail.com">remi.cura@gmail.com</a>><br clear="none"><b>To:</b> PostGIS Users Discussion <<a rel="nofollow" shape="rect" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>> <br clear="none"><b>Cc:</b> Joseph Spenner <<a rel="nofollow" shape="rect" ymailto="mailto:joseph85750@yahoo.com" target="_blank" href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>> <br clear="none"><b>Sent:</b> Tuesday, November 18, 2014 4:20 AM<br clear="none"><b>Subject:</b> Re: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14864"><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div><div id="yiv6953499053"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14863"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14862"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14861"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14860"><div id="yiv6953499053yui_3_16_0_1_1416322189684_14892"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Something like this?<br clear="none"><br clear="none"></span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14859"><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14894"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">SELECT zone,gid,state,name,ST_Asgeojson( geom ) <br clear="none"><br clear="none"></span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14865"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">FROM polys </span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14896"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">WHERE ST_Overlaps(ST_GeomFromText('POLYGON((-109 42,-108 42, -108 43; -109 43, -109 42))', 4269), geom)=TRUE;</span><span style=""></span></div></div></div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Cheers,<br clear="none">Rémi-C</span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_14898"><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16761"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="">2014-11-18 9:00 GMT+01:00 Hugues François <<a rel="nofollow" shape="rect" ymailto="mailto:hugues.francois@irstea.fr" target="_blank" href="mailto:hugues.francois@irstea.fr">hugues.francois@irstea.fr</a>>:<br clear="none"><br clear="none"></span></div><div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div><div id="yiv6953499053yqt29967"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16759"><div id="yiv6953499053yui_3_16_0_1_1416322189684_16758"><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;">Hello,</span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16757"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16763"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;" lang="EN-GB">Maybe I don’t understand your problem very well but I think your query for points should work with a polygon using ST_GeomFromText (<a rel="nofollow" shape="rect" id="yiv6953499053yui_3_16_0_1_1416322189684_16765" target="_blank" href="http://www.postgis.org/docs/ST_GeomFromText.html">http://www.postgis.org/docs/ST_GeomFromText.html</a>) for your input polygon or a subquery if it stored into your DB.</span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_16764"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;" lang="EN-GB"> </span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17010"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;" lang="EN-GB">Hugues.</span><span style=""></span></div></div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:11.0pt;"> </span><span style=""></span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17067"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17066" style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17065"><div class="yiv6953499053MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;">De :</span></b><span style="font-size:10.0pt;"> <a rel="nofollow" shape="rect" ymailto="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank" href="mailto:postgis-users-bounces@lists.osgeo.org">postgis-users-bounces@lists.osgeo.org</a> [mailto:<a rel="nofollow" shape="rect" ymailto="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank" href="mailto:postgis-users-bounces@lists.osgeo.org">postgis-users-bounces@lists.osgeo.org</a>] <b>De la part de</b> Joseph Spenner<br clear="none"><b>Envoyé :</b> lundi 17 novembre 2014 22:35<br clear="none"><b>À :</b> PostGIS Users Discussion<br clear="none"><b>Objet :</b> [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style=""></span></div></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17064"><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17013"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17075"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17074"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Hello, I'm trying to perform a query which will return any polygons which have any points in common with an input polygon.</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17063"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17062"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17061"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17060"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">So, if I have Polygon A.</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17012"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17011"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">In my database, I have several other polygons stored.</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17015"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17014"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17019"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17018"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">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.</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17036"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17035"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17021"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17020"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Can this be done?</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17034"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17033"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"><br clear="none">I found this:</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17030"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17029"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"><a rel="nofollow" shape="rect" target="_blank" href="http://postgis.net/docs/ST_Overlaps.html">http://postgis.net/docs/ST_Overlaps.html</a></span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17023"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17022"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17028"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17027"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">But from what I can tell, it only returns a T or F. I need to fetch the actual polygons if T.</span><span style=""></span></div></div></div><div id="yiv6953499053yui_3_16_0_1_1416322189684_17025"><div id="yiv6953499053yui_3_16_0_1_1416322189684_17024"><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">I'm currently able to query with points as input:</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">select zone,gid,state,name,ST_Asgeojson( geom ) from polys where ST_Intersects(ST_PointFromText('POINT(-109 42)', 4269), geom);</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">But now I have a need to use polygons as input.</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Any help would be great.</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Thanks!</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Regards,</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;">Joseph Spenner</span><span style=""></span></div></div></div><div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div><div><div class="yiv6953499053MsoNormal" style="background:white;"><span style="font-size:10.5pt;"> </span><span style=""></span></div></div></div></div></div></div><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""><br clear="none">_______________________________________________<br clear="none">postgis-users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a></span></div></div><div class="yiv6953499053MsoNormal" style="background:white;"><span style=""> </span></div></div></div></div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div></div></div></div></div></div></div><div class="yiv6953499053MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style=""> </span></div></div></div></div></div></div></div></div></div><br><br></div> </div> </div> </div></body></html>