[postgis-users] Unexplained results when using Intersection?

Kevin Neufeld kneufeld at refractions.net
Tue Oct 30 16:41:31 PDT 2007

Hi Craig,

What is it you are trying to do exactly?

Reading your query, I see that you are interested in the intersection of 
all geometries in "evc" and "bnd_buf" where the geometries overlap (by 
definition, this means that the interior of one polygon is both inside 
and outside that of another polygon) and where "buf_dist" = 1.  So, 
you're not interested in cases where a polygon in "env" is contained 
wholly inside "bnd_buf".  Right?

Did you mean to filter with "overlaps"? Or did you mean "intersects"?

Kevin Neufeld
Software Developer
Refractions Research Inc.
300-1207 Douglas St.
Victoria, B.C., V8W 2E7

Phone: (250) 383-3022
Email: kneufeld at refractions.net

Craig Feuerherdt wrote:
> I have been attempting to intersect on set of geometries (bio.evc) 
> with another geometry (bio.bnd_buf). All the geometries are valid 
> according to isvalid and the query below successfully returns a table.
> create table bio.bnd_evc as
> select a.buf_dist, b.bio_no, b.bio_code, b.evc, b.constcde, 
> b.consstat, b.density, intersection(a.the_geom, b.the_geom) as the_geom
> from bio.bnd_buf as a, bio.evc as b
> where a.the_geom && b.the_geom
> and a.buf_dist = 1
> and overlaps(a.the_geom, b.the_geom)
> When I view the resulting table (bnd_evc) in QGIS there are several 
> missing polygons ( image 1a 
> <http://www.bendigo-orienteers.com.au/study/evc1_over.png>). One of 
> the polygons lies entirely within bnd_bnf while the other has a small 
> portion which overlaps the boundary.
> When I try intersecting the same geometries but this time selecting 
> buf_dist = 1000 (the 1000m buffer), additional evc polygons (which are 
> wholly within buf_dist=1 and therefore also within buf_dist=1000) are 
> missing from the output table and the whole thing is a 'mess' nad is 
> in no way a representation of what the intersection shoul dlook like ( 
> image 2a <http://www.bendigo-orienteers.com.au/study/evc1000_over.png>).
> The other thing that occurs in both cases is that some polygon 
> geometries are created where there are no evc polygons ( image 1b 
> <http://www.bendigo-orienteers.com.au/study/evc1_under.png> & 2b 
> <http://www.bendigo-orienteers.com.au/study/evc1000_under.png>).
> Both tables have a GIST index on the geometry column (the_geom).
> Are the issues associated with having multiple polygon geometries in 
> the one table (unlikely in my opinion)?
> Is it something to do with the query?
> Are these issues associated with PostGIS or GEOS?
> Is there a work around to solve the issue?
> Thanks in advance,
> Craig
> ------------------------------------------------------------------------
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

More information about the postgis-users mailing list