<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_1421843595215_210862">Pete:</div><div id="yui_3_16_0_1_1421843595215_210860" dir="ltr">  Thanks for the reply!</div><div id="yui_3_16_0_1_1421843595215_210858" dir="ltr">  But I just tried, and ST_Contains will miss if the alert polygon spans multiple states.  I have an example which spans a bit of California and Arizona.  When I select AZ or CA, I get nothing back.  So it appears, as the documentation states, ST_Contains will only return true if all of the points in "A" are completely inside "B".</div><div id="yui_3_16_0_1_1421843595215_210990" dir="ltr"><br></div><div id="yui_3_16_0_1_1421843595215_210856" dir="ltr"><br></div><br><div id="yui_3_16_0_1_1421843595215_210843"><br><div id="yui_3_16_0_1_1421843595215_210848">
<br></div></div><br>  <div id="yui_3_16_0_1_1421843595215_210853" style="font-family: garamond, new york, times, serif; font-size: 14px;"> <div id="yui_3_16_0_1_1421843595215_210852" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div id="yui_3_16_0_1_1421843595215_210851" dir="ltr"> <hr id="yui_3_16_0_1_1421843595215_210850" size="1">  <font id="yui_3_16_0_1_1421843595215_210903" face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Pete Yunker <peter.yunker@homejunction.com><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, January 21, 2015 3:17 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] Possible for ST_Intersects to not include the perimeter?<br> </font> </div> <div id="yui_3_16_0_1_1421843595215_210908" class="y_msg_container"><br><div id="yiv0564806117"><div id="yui_3_16_0_1_1421843595215_210907"><div id="yui_3_16_0_1_1421843595215_210914">I believe you want ST_Contains.  Using sample Census TIGER data for states and counties:</div><div id="yui_3_16_0_1_1421843595215_210912"><br clear="none"></div><div id="yui_3_16_0_1_1421843595215_210906"><div id="yui_3_16_0_1_1421843595215_210910"><font id="yui_3_16_0_1_1421843595215_211019" face="Courier New">SELECT COUNT(c.*)</font></div><div id="yui_3_16_0_1_1421843595215_210905"><font id="yui_3_16_0_1_1421843595215_211021" face="Courier New">FROM prod.states s</font></div><div id="yui_3_16_0_1_1421843595215_211023"><font id="yui_3_16_0_1_1421843595215_211025" face="Courier New">INNER JOIN prod.counties c</font></div><div id="yui_3_16_0_1_1421843595215_211028"><font id="yui_3_16_0_1_1421843595215_211027" face="Courier New">ON (s.name = 'Georgia'</font></div><div id="yui_3_16_0_1_1421843595215_211031"><font id="yui_3_16_0_1_1421843595215_211030" face="Courier New">AND ST_Contains(s.the_geom, c.the_geom));</font></div><div id="yui_3_16_0_1_1421843595215_211033"><font face="Courier New">--159</font></div><div id="yui_3_16_0_1_1421843595215_211035"><font face="Courier New"><br clear="none"></font></div><div id="yui_3_16_0_1_1421843595215_211038"><font id="yui_3_16_0_1_1421843595215_211037" face="Courier New">SELECT COUNT(*) from prod.counties WHERE state_cd = 'GA';</font></div><div id="yui_3_16_0_1_1421843595215_211040"><font face="Courier New">--159</font></div></div><div id="yui_3_16_0_1_1421843595215_211042"><br clear="none"></div><div id="yui_3_16_0_1_1421843595215_211044">I suppose it's possible that the NWS polygons aren't using the exact same county/boundary border as your reference states boundaries.  As such, you could also use a slight negative buffer on the NWS polygons to further ensure that they don't overlap an adjacent state border.</div><div id="yui_3_16_0_1_1421843595215_211046"><br clear="none"></div><div id="yui_3_16_0_1_1421843595215_211048">Regards,</div><div id="yui_3_16_0_1_1421843595215_211050">Pete Yunker</div><div><br clear="none"></div><div><div class="qtdSeparateBR"><br><br></div><div class="yiv0564806117yqt1014154305" id="yiv0564806117yqt26588"><div>On Jan 21, 2015, at 5:01 PM, Joseph Spenner <<a rel="nofollow" shape="rect" ymailto="mailto:joseph85750@yahoo.com" target="_blank" href="mailto:joseph85750@yahoo.com">joseph85750@yahoo.com</a>> wrote:</div><br class="yiv0564806117Apple-interchange-newline" clear="none"><blockquote type="cite"><div><div style="background-color:rgb(255, 255, 255);font-family:garamond, 'new york', times, serif;font-size:14px;"><div id="yiv0564806117yui_3_16_0_1_1421843595215_200324">For the record, my best guess (which didn't work) was:</div><div id="yiv0564806117yui_3_16_0_1_1421843595215_200326"><br clear="none"></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_200386">select ST_Asgeojson( geom ) from polys where ST_Intersects(ST_GeomFromGeoJSON('$jsonPoly'), geom)=TRUE and ST_Touches(ST_GeomFromGeoJSON('$jsonPoly'), geom)=FALSE<br class="yiv0564806117" style="" clear="none"><br clear="none"></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_200328">Since 'touch' seemed to be the way to address the perimeter points.  But apparently this is not the case.</div><div dir="ltr"><br clear="none"></div><div id="yiv0564806117yui_3_16_0_1_1421843595215_200330"><br clear="none"></div><div id="yiv0564806117yui_3_16_0_1_1421843595215_200318"><br clear="none"><div id="yiv0564806117yui_3_16_0_1_1421843595215_200332">
<br clear="none"></div></div><br clear="none">  <div id="yiv0564806117yui_3_16_0_1_1421843595215_200336" style="font-family:garamond, new york, times, serif;font-size:14px;"> <div id="yiv0564806117yui_3_16_0_1_1421843595215_200335" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_200334"> <hr size="1">  <font id="yiv0564806117yui_3_16_0_1_1421843595215_200338" face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></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><span style="font-weight:bold;">To:</span></b> "<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>" <<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><span style="font-weight:bold;">Sent:</span></b> Wednesday, January 21, 2015 2:22 PM<br clear="none"> <b><span style="font-weight:bold;">Subject:</span></b> Possible for ST_Intersects to not include the perimeter?<br clear="none"> </font> </div> <div class="yiv0564806117y_msg_container" id="yiv0564806117yui_3_16_0_1_1421843595215_200340"><br clear="none"><div id="yiv0564806117"><div id="yiv0564806117yui_3_16_0_1_1421843595215_200343"><div id="yiv0564806117yui_3_16_0_1_1421843595215_200342" style="background-color:rgb(255, 255, 255);font-family:garamond, 'new york', times, serif;font-size:14px;"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">I have a polygon as an input, and I'm trying to find all polygons which share points, but not the perimiter points themselves.  Is this possible?</span><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_194991"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_194992"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Real application:</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_194993"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">  I have NWS polygons describing Thunderstorm Warnings, which are made up of counties within the state.  Some of those counties might be on the edge of the state.  I want to query my database to show me all Warnings which are in a supplied state.  However, if I query the <i id="yiv0564806117yui_3_16_0_1_1421843595215_200347">adjacent</i> state which borders the counties from the first state, I get those Warnings because they share the same parimeter points.</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195026"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195032"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Is there a way to construct a query which will not return anything if the only points in common are the perimeter values themselves?</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195033"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195034"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">I tried a few variations on ST_Intersects/ST_Covers/ST_Contains/ST_Overlaps, supplying various AND/OR and TRUE/FALSE combinatins, but I can't seem to get the right combo to accomplish my task.</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195087"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195088"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Any help would be great.</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195107"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195106"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Thanks!</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195091"><br clear="none"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968"></span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195090"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Regards,</span></div><div dir="ltr" id="yiv0564806117yui_3_16_0_1_1421843595215_195089"><span id="yiv0564806117yui_3_16_0_1_1421843595215_194968">Joseph Spenner</span><br clear="none"></div><div id="yiv0564806117yui_3_16_0_1_1421843595215_194841"><br clear="none"><div id="yiv0564806117yui_3_16_0_1_1421843595215_195015">
<br clear="none"></div></div></div></div></div><br clear="none"><br clear="none"></div> </div> </div>  </div></div>_______________________________________________<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">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</blockquote></div></div><br clear="none"></div></div><br><br></div> </div> </div>  </div></body></html>