<html><body><div style="color:#000; background-color:#fff; font-family:garamond, new york, times, serif;font-size:14px"><div id="yiv4647088579"><div id="yui_3_16_0_1_1422892475699_66013"><div id="yui_3_16_0_1_1422892475699_66012" style="color:#000;background-color:#fff;font-family:garamond, new york, times, serif;font-size:14px;"><div id="yiv4647088579yui_3_16_0_1_1422892475699_64498"><span></span></div><div>Chris:</div><div dir="ltr"> I've been trying to get your suggestion to work as well, but appear to be having some problem with the syntax.</div><div dir="ltr"><br></div><div dir="ltr">I currently have a situation where I have a polygon completely inside of a state, as well as a couple on the border.</div><div dir="ltr">I have a query, but it returns ZERO:</div><div dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66295" dir="ltr">select ST_Asgeojson( geom ) from table where ST_Intersects(ST_GeomFromGeoJSON('$state'), geom)=TRUE and ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$state'), geom))>1<br style="" class=""></div><div id="yui_3_16_0_1_1422892475699_66340" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66514" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66341" dir="ltr">I have been using the following, with pretty good success:</div><div id="yui_3_16_0_1_1422892475699_66342" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66350" dir="ltr">select ST_Asgeojson( geom ) from table where ST_Intersects(ST_GeomFromGeoJSON('$state'), geom)=TRUE and ST_Touches(ST_GeomFromGeoJSON('$state'), geom)=FALSE<br style="" class=""></div><div id="yui_3_16_0_1_1422892475699_66352" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66425" dir="ltr">But sometimes, there seems to be a really tiny square centimeter of area which makes the above succeed, so I would like to have at least some value to describe "how much intersection?" there is. But even using a small value (1), it always makes my select return no rows.</div><div id="yui_3_16_0_1_1422892475699_66517" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66518" dir="ltr">Ideas?</div><div id="yui_3_16_0_1_1422892475699_66519" dir="ltr"><br>Thanks!</div><div id="yui_3_16_0_1_1422892475699_66520" dir="ltr"><br></div><div id="yui_3_16_0_1_1422892475699_66584" dir="ltr">Regardds,</div><div id="yui_3_16_0_1_1422892475699_66583" dir="ltr">Joseph Spenner</div><div id="yui_3_16_0_1_1422892475699_66582" dir="ltr"><br></div><div id="yiv4647088579yui_3_16_0_1_1422892475699_64496"><br clear="none"></div> <div class="qtdSeparateBR"><br><br></div><div class="yiv4647088579yqt0855580976" id="yiv4647088579yqt12816"><div id="yiv4647088579yui_3_16_0_1_1422892475699_64527" style="font-family:garamond, new york, times, serif;font-size:14px;"> <div id="yiv4647088579yui_3_16_0_1_1422892475699_64526" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv4647088579yui_3_16_0_1_1422892475699_64525"> <hr id="yui_3_16_0_1_1422892475699_66298" size="1"> <font id="yiv4647088579yui_3_16_0_1_1422892475699_64528" face="Arial" size="2"> <b id="yui_3_16_0_1_1422892475699_66294"><span id="yui_3_16_0_1_1422892475699_66293" style="font-weight:bold;">From:</span></b> Christopher Swingley <cswingle@swingleydev.com><br clear="none"> <b><span style="font-weight:bold;">To:</span></b> Joseph Spenner <joseph85750@yahoo.com> <br clear="none"><b><span style="font-weight:bold;">Cc:</span></b> PostGIS Users Discussion <postgis-users@lists.osgeo.org> <br clear="none"> <b id="yui_3_16_0_1_1422892475699_66292"><span id="yui_3_16_0_1_1422892475699_66291" style="font-weight:bold;">Sent:</span></b> Wednesday, January 21, 2015 4:58 PM<br clear="none"> <b id="yui_3_16_0_1_1422892475699_66290"><span id="yui_3_16_0_1_1422892475699_66289" style="font-weight:bold;">Subject:</span></b> Re: [postgis-users] Possible for ST_Intersects to not include the perimeter?<br clear="none"> </font> </div> <div id="yui_3_16_0_1_1422892475699_66280" class="yiv4647088579y_msg_container"><br clear="none">Joseph,<br clear="none"><br clear="none">On Wed, Jan 21, 2015 at 2:34 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 id="yui_3_16_0_1_1422892475699_66281" class="yiv4647088579qtdSeparateBR"><br clear="none"><br clear="none"></div><div class="yiv4647088579yqt3172152194" id="yiv4647088579yqtfd57069"><br clear="none">> I have NWS polygons describing Thunderstorm Warnings, which are made up of<br clear="none">> counties within the state. Some of those counties might be on the edge of<br clear="none">> the state. I want to query my database to show me all Warnings which are in<br clear="none">> a supplied state. However, if I query the adjacent state which borders the<br clear="none">> counties from the first state, I get those Warnings because they share the<br clear="none">> same parimeter points.</div><br clear="none"><br clear="none">What about finding the states that intersect thunderstorm warnings<br clear="none">where the intersection area is greater than some small threshold?<br clear="none">Something like:<br clear="none"><br clear="none">ST_Intersects(warning_geom, state_geom) AND<br clear="none">ST_Area(ST_Intersection(warning_geom, state_geom)) > 1000<br clear="none"><br clear="none">Cheers,<br clear="none"><br clear="none">Chris<br clear="none">-- <br clear="none">Christopher Swingley<br clear="none">Fairbanks, Alaska<br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://swingleydev.com/">http://swingleydev.com/</a><br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:cswingle@swingleydev.com" target="_blank" href="mailto:cswingle@swingleydev.com">cswingle@swingleydev.com</a><div class="yiv4647088579yqt3172152194" id="yiv4647088579yqtfd70884"><br clear="none"></div><br clear="none"><br clear="none"></div> </div> </div></div> </div></div></div></div></body></html>