[postgis-users] Possible for ST_Intersects to not include the perimeter?

Joseph Spenner joseph85750 at yahoo.com
Mon Feb 2 11:27:54 PST 2015


Regina:  That was the fix!  I'm still trying to get this all figured out, but I'm slowly making progress.  I used 10 instead of 1, which seemed like a fair guess.  This eliminated my border match.

Thanks for the help!
Regards,Joseph Spenner
 If life gives you lemons, keep them-- because hey.. free lemons.


"~heart~ Sticker"  fixer:  http://microflush.org/stuff/stickers/heartFix.html



   

   From: Paragon Corporation <lr at pcorp.us>
 To: 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org> 
 Sent: Monday, February 2, 2015 11:58 AM
 Subject: Re: [postgis-users] Possible for ST_Intersects to not include the perimeter?
   
#yiv6695718167 -- filtered {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;}#yiv6695718167 filtered {panose-1:2 4 5 3 5 4 6 3 2 4;}#yiv6695718167 filtered {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv6695718167 filtered {font-family:Garamond;panose-1:2 2 4 4 3 3 1 1 8 3;}#yiv6695718167 p.yiv6695718167MsoNormal, #yiv6695718167 li.yiv6695718167MsoNormal, #yiv6695718167 div.yiv6695718167MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;}#yiv6695718167 a:link, #yiv6695718167 span.yiv6695718167MsoHyperlink {color:blue;text-decoration:underline;}#yiv6695718167 a:visited, #yiv6695718167 span.yiv6695718167MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv6695718167 span.yiv6695718167EmailStyle17 {color:#1F497D;}#yiv6695718167 .yiv6695718167MsoChpDefault {font-size:10.0pt;}#yiv6695718167 filtered {margin:1.0in 1.0in 1.0in 1.0in;}#yiv6695718167 div.yiv6695718167WordSection1 {}#yiv6695718167 What is the spatial reference system of your data.  If it’s in degrees, your areas are all going to be all < 1.  You’d have to go with something like 0.0001 or cast your data to geography when you do the check  e.g. assuming your srid is 4326   select ST_Asgeojson( geom ) from table where ST_Intersects(ST_GeomFromGeoJSON('$state'), geom)=TRUE and ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$state')::geography, geom::geography))>1  Hope that helps,  Reginahttp://www.postgis.ushttp://postgis.net      

From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Joseph Spenner
Sent: Monday, February 02, 2015 1:31 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Possible for ST_Intersects to not include the perimeter?  Chris:  I've been trying to get your suggestion to work as well, but appear to be having some problem with the syntax.  I currently have a situation where I have a polygon completely inside of a state, as well as a couple on the border.I have a query, but it returns ZERO:  select ST_Asgeojson( geom ) from table where ST_Intersects(ST_GeomFromGeoJSON('$state'), geom)=TRUE and ST_Area(ST_Intersection(ST_GeomFromGeoJSON('$state'), geom))>1    I have been using the following, with pretty good success:  select ST_Asgeojson( geom ) from table where ST_Intersects(ST_GeomFromGeoJSON('$state'), geom)=TRUE and ST_Touches(ST_GeomFromGeoJSON('$state'), geom)=FALSE  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.  Ideas?
Thanks!  Regardds,Joseph Spenner      From: Christopher Swingley <cswingle at swingleydev.com>
To: Joseph Spenner <joseph85750 at yahoo.com> 
Cc: PostGIS Users Discussion <postgis-users at lists.osgeo.org> 
Sent: Wednesday, January 21, 2015 4:58 PM
Subject: Re: [postgis-users] Possible for ST_Intersects to not include the perimeter?
Joseph,

On Wed, Jan 21, 2015 at 2:34 PM, Joseph Spenner <joseph85750 at yahoo.com> wrote:  
>  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 adjacent state which borders the
> counties from the first state, I get those Warnings because they share the
> same parimeter points.

What about finding the states that intersect thunderstorm warnings
where the intersection area is greater than some small threshold?
Something like:

ST_Intersects(warning_geom, state_geom) AND
ST_Area(ST_Intersection(warning_geom, state_geom)) > 1000

Cheers,

Chris
-- 
Christopher Swingley
Fairbanks, Alaska
http://swingleydev.com/
cswingle at swingleydev.com    
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

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


More information about the postgis-users mailing list