<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div dir="ltr" id="yui_3_16_0_1_1415903324068_720462"><span id="yui_3_16_0_1_1415903324068_720507">It may not be required, if ST_Intersects() does what you need, but you can also use ST_Relate() - whish will return polygons matching any spatial relationship except disjoint - functionally equivalaent to "not ST_Disjoint()"</span></div><div id="yui_3_16_0_1_1415903324068_720681" dir="ltr"><br><span id="yui_3_16_0_1_1415903324068_720507"></span></div><div id="yui_3_16_0_1_1415903324068_720684" dir="ltr">Cheers,</div><div id="yui_3_16_0_1_1415903324068_720685" dir="ltr"><br></div><div dir="ltr"> Brent Wood<br></div><div><br> </div><div id="yui_3_16_0_1_1415903324068_720487" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"> <div id="yui_3_16_0_1_1415903324068_720486" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1415903324068_720485" dir="ltr"> <hr id="yui_3_16_0_1_1415903324068_720489" size="1"> <font id="yui_3_16_0_1_1415903324068_720488" 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> Wednesday, November 19, 2014 4: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_1415903324068_720508" class="y_msg_container"><br><div id="yiv5627516190"><style><!--
#yiv5627516190
_filtered #yiv5627516190 {font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv5627516190 {font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
_filtered #yiv5627516190 {font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv5627516190 {font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
_filtered #yiv5627516190 {font-family:Garamond;
panose-1:2 2 4 4 3 3 1 1 8 3;}
#yiv5627516190
#yiv5627516190 p.yiv5627516190MsoNormal, #yiv5627516190 li.yiv5627516190MsoNormal, #yiv5627516190 div.yiv5627516190MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman", "serif";}
#yiv5627516190 a:link, #yiv5627516190 span.yiv5627516190MsoHyperlink
{
color:blue;
text-decoration:underline;}
#yiv5627516190 a:visited, #yiv5627516190 span.yiv5627516190MsoHyperlinkFollowed
{
color:purple;
text-decoration:underline;}
#yiv5627516190 p.yiv5627516190MsoAcetate, #yiv5627516190 li.yiv5627516190MsoAcetate, #yiv5627516190 div.yiv5627516190MsoAcetate
{
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma", "sans-serif";}
#yiv5627516190 span.yiv5627516190EmailStyle17
{
font-family:"Calibri", "sans-serif";
color:#1F497D;}
#yiv5627516190 span.yiv5627516190TextedebullesCar
{
font-family:"Tahoma", "sans-serif";}
#yiv5627516190 .yiv5627516190MsoChpDefault
{
font-size:10.0pt;}
_filtered #yiv5627516190 {
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
#yiv5627516190 div.yiv5627516190WordSection1
{}
--></style><div id="yui_3_16_0_1_1415903324068_720511"><div id="yui_3_16_0_1_1415903324068_720510" class="yiv5627516190WordSection1"><div id="yui_3_16_0_1_1415903324068_720509" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB">Hi,</span></div><div id="yui_3_16_0_1_1415903324068_720512" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1415903324068_720514" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720513" style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB">I think ST_Intersects will meet your needs :</span></div><div id="yui_3_16_0_1_1415903324068_720515" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1415903324068_720517" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720516" style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB">SELECT zone,gid,state,name,ST_Asgeojson( geom ) </span></div><div id="yui_3_16_0_1_1415903324068_720519" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720518" style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB">FROM polys </span></div><div id="yui_3_16_0_1_1415903324068_720520" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720521" style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" 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_1415903324068_720522" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1415903324068_720524" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720523" style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB">Hugues.</span></div><div id="yui_3_16_0_1_1415903324068_720525" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1415903324068_720526" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;" lang="EN-GB"> </span></div><div id="yui_3_16_0_1_1415903324068_720529"><div id="yui_3_16_0_1_1415903324068_720528" class="yiv5627516190MsoNormal"><b id="yui_3_16_0_1_1415903324068_720527"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">Hugues François</span></b><b><span style="font-size:10.0pt;color:black;"></span></b></div><div id="yui_3_16_0_1_1415903324068_720530" class="yiv5627516190MsoNormal"><span id="yui_3_16_0_1_1415903324068_720531" style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009EE0;">Tourisme et systèmes d’information</span><span style="font-size:13.5pt;color:black;"></span></div><div id="yui_3_16_0_1_1415903324068_720532" class="yiv5627516190MsoNormal"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009EE0;">Irstea – DTM</span></div><div id="yui_3_16_0_1_1415903324068_720533" class="yiv5627516190MsoNormal"><span style="font-size:13.5pt;color:black;"> </span></div><div id="yui_3_16_0_1_1415903324068_720534" class="yiv5627516190MsoNormal"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">+33 </span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009DE0;">(</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">0</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009DE0;">)</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">4.76.76.27.44</span><span style="font-size:13.5pt;color:black;"></span></div><div id="yui_3_16_0_1_1415903324068_720535" class="yiv5627516190MsoNormal"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">+33 </span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009DE0;">(</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">0</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#009DE0;">)</span><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:#003980;">6.77.66.21.31</span><span style="font-size:13.5pt;color:black;"></span></div></div><div id="yui_3_16_0_1_1415903324068_720536" class="yiv5627516190MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri", "sans-serif";color:#1F497D;"> </span></div><div id="yui_3_16_0_1_1415903324068_720538"><div id="yui_3_16_0_1_1415903324068_720537" style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;"><div id="yui_3_16_0_1_1415903324068_720539" class="yiv5627516190MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma", "sans-serif";">De :</span></b><span id="yui_3_16_0_1_1415903324068_720540" style="font-size:10.0pt;font-family:"Tahoma", "sans-serif";"> postgis-users-bounces@lists.osgeo.org [mailto:postgis-users-bounces@lists.osgeo.org] <b>De la part de</b> Joseph Spenner<br><b>Envoyé :</b> mardi 18 novembre 2014 16:44<br><b>À :</b> PostGIS Users Discussion<br><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="yiv5627516190MsoNormal"> </div><div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16747"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">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" target="_blank" href="http://postgis.net/docs/ST_Overlaps.html" id="yiv5627516190yui_3_16_0_1_1416322189684_17135">http://postgis.net/docs/ST_Overlaps.html</a></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17103"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17081"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> "<b id="yiv5627516190yui_3_16_0_1_1416322189684_17101"><i id="yiv5627516190yui_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="yiv5627516190yui_3_16_0_1_1416322189684_17082"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17083"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">I do need the polygons which are completely contained as well. Can this be done?</span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17085"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17099"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">Thanks again for the help. I'm getting there!</span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17098"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17086"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">Regards,</span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17097"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">Joseph Spenner</span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17087"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16748"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16742"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16749"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div></div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16752"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16751"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16750"><div class="yiv5627516190MsoNormal" style="text-align:center;background:white;" align="center"><span style="font-family:"Helvetica", "sans-serif";color:black;"><hr align="center" size="1" width="100%"></span></div><div class="yiv5627516190MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;">From:</span></b><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;"> Joseph Spenner <<a rel="nofollow" ymailto="mailto:joseph85750@yahoo.com" target="_blank" href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>><br><b>To:</b> Rémi Cura <<a rel="nofollow" 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" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>> <br><b>Sent:</b> Tuesday, November 18, 2014 8:35 AM<br><b>Subject:</b> Re: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16754"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div><div id="yiv5627516190"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16756"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16755"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14848"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;">Rémi:</span><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14857"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;"> Yes, that worked perfectly. Thanks!</span><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14888"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;"> 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;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14887"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;"><br>Thanks again for the responses!</span><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14886"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14858"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;">Regards,</span><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14885"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;">Joseph Spenner</span><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14884"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14834"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14836"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14835"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;">If life gives you lemons, keep them-- because hey.. free lemons. </span></div></div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14837"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"><br>"~heart~ Sticker" fixer: <a rel="nofollow" target="_blank" href="http://microflush.org/stuff/stickers/heartFix.html">http://microflush.org/stuff/stickers/heartFix.html</a> </span></div></div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14838"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div></div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div><div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-size:10.5pt;font-family:"Garamond", "serif";color:black;"> </span></div></div><div id="yiv5627516190yqt68408"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14842"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14841"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14840"><div class="yiv5627516190MsoNormal" style="text-align:center;background:white;" align="center"><span style="font-family:"Helvetica", "sans-serif";color:black;"><hr align="center" size="1" width="100%"></span></div><div class="yiv5627516190MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;">From:</span></b><span style="font-size:10.0pt;font-family:"Arial", "sans-serif";color:black;"> Rémi Cura <<a rel="nofollow" ymailto="mailto:remi.cura@gmail.com" target="_blank" href="mailto:remi.cura@gmail.com">remi.cura@gmail.com</a>><br><b>To:</b> PostGIS Users Discussion <<a rel="nofollow" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a>> <br><b>Cc:</b> Joseph Spenner <<a rel="nofollow" ymailto="mailto:joseph85750@yahoo.com" target="_blank" href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>> <br><b>Sent:</b> Tuesday, November 18, 2014 4:20 AM<br><b>Subject:</b> Re: [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14864"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div><div id="yiv5627516190"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14863"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14862"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14861"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14860"><div id="yiv5627516190yui_3_16_0_1_1416322189684_14892"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Something like this?<br><br></span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14859"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14894"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">SELECT zone,gid,state,name,ST_Asgeojson( geom ) <br><br></span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14865"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">FROM polys </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14896"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">WHERE ST_Overlaps(ST_GeomFromText('POLYGON((-109 42,-108 42, -108 43; -109 43, -109 42))', 4269), geom)=TRUE;</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Cheers,<br>Rémi-C</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_14898"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16761"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;">2014-11-18 9:00 GMT+01:00 Hugues François <<a rel="nofollow" ymailto="mailto:hugues.francois@irstea.fr" target="_blank" href="mailto:hugues.francois@irstea.fr">hugues.francois@irstea.fr</a>>:<br><br></span></div><div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div><div id="yiv5627516190yqt29967"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16759"><div id="yiv5627516190yui_3_16_0_1_1416322189684_16758"><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;">Hello,</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16757"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16763"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;" 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" target="_blank" href="http://www.postgis.org/docs/ST_GeomFromText.html" id="yiv5627516190yui_3_16_0_1_1416322189684_16765">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="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_16764"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;" lang="EN-GB"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17010"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;" lang="EN-GB">Hugues.</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:11.0pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17067"><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;" id="yiv5627516190yui_3_16_0_1_1416322189684_17066"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17065"><div class="yiv5627516190MsoNormal" style="background:white;"><b><span style="font-size:10.0pt;font-family:"Helvetica", "sans-serif";color:black;">De :</span></b><span style="font-size:10.0pt;font-family:"Helvetica", "sans-serif";color:black;"> <a rel="nofollow" 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" 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><b>Envoyé :</b> lundi 17 novembre 2014 22:35<br><b>À :</b> PostGIS Users Discussion<br><b>Objet :</b> [postgis-users] Returning polygons if any of a polygon input points lie in the polygons</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17064"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17013"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17075"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17074"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">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="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17063"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17062"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17061"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17060"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">So, if I have Polygon A.</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17012"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17011"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">In my database, I have several other polygons stored.</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17015"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17014"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17019"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17018"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">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="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17036"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17035"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17021"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17020"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Can this be done?</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17034"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17033"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"><br>I found this:</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17030"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17029"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"><a rel="nofollow" target="_blank" href="http://postgis.net/docs/ST_Overlaps.html">http://postgis.net/docs/ST_Overlaps.html</a></span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17023"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17022"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17028"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17027"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">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="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div id="yiv5627516190yui_3_16_0_1_1416322189684_17025"><div id="yiv5627516190yui_3_16_0_1_1416322189684_17024"><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">I'm currently able to query with points as input:</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">select zone,gid,state,name,ST_Asgeojson( geom ) from polys where ST_Intersects(ST_PointFromText('POINT(-109 42)', 4269), geom);</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">But now I have a need to use polygons as input.</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Any help would be great.</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Thanks!</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Regards,</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;">Joseph Spenner</span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div><div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-size:10.5pt;font-family:"Helvetica", "sans-serif";color:black;"> </span><span style="font-family:"Helvetica", "sans-serif";color:black;"></span></div></div></div></div></div></div><div class="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"><br>_______________________________________________<br>postgis-users mailing list<br><a rel="nofollow" ymailto="mailto:postgis-users@lists.osgeo.org" target="_blank" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br><a rel="nofollow" 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="yiv5627516190MsoNormal" style="background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div></div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div></div></div></div></div></div><div class="yiv5627516190MsoNormal" style="margin-bottom:12.0pt;background:white;"><span style="font-family:"Helvetica", "sans-serif";color:black;"> </span></div></div></div></div></div></div></div></div><br>_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@lists.osgeo.org" href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br><br></div> </div> </div> </div></body></html>