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

Joseph Spenner joseph85750 at yahoo.com
Mon Feb 2 10:31:20 PST 2015


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


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


More information about the postgis-users mailing list