[geos-devel] bad input data or robustness issue?

Martin Davis mbdavis at refractions.net
Mon Mar 3 16:16:51 EST 2008

As you've noticed, the predicates are not necessarily consistent with 
the overlay operations.  This is because the predicates are exact, 
whereas the overlay operations are approximate (which is unavoidable, 
since they operated in a finite-precision model).

So, don't rely on this in your code. If you determine that two polygons 
overlap, you still have to check for an empty intersection and handle it 
appropriately.  This should only happen when the area of overlap is so 
small as to be negligible, in any case.

Also, try using a limited-precision model.  Round of the numbers in your 
input, and use an explicit PrecisionModel to control the precision of 
the computed output.  This should increase stability.

It might also help if you checked the area of intersections and 
differences and eliminated ones with very small areas (since these 
should be below the accuracy of your input data in any case).

HTH - Martin

Russell Strong wrote:
> Hi all,
> I'm trying to dissect up a bunch of nearly round overlapping polygons, 
> ie.. trying to find areas of overlapping radar coverage given a set of 
> radar locations and ranges.
> However, trying this with a few polygons, testing each case I can 
> think of works very well.  Add a few more and I get all sorts of 
> errors including:
> * side location conflict
> * stuck in endless loop ( due to intersect and difference operations 
> that produce the same  polygons as we started with )
> * non-noded intersection
> * no outgoing dirEdge found
> I've included some test code that shows all of these,  ( uncomment 
> various tests in main ).  If anyone has some time to run these and 
> comment I'd appreciate it.  I've spent 5 solid days on it and I'm out 
> of ideas.
> it basically works like this:
> I keep a link list of "areas" which contain a geometry.  I then 
> compare each geometry against each other ( except for self ).  If it 
> intersects, I add the intersection and the 2 differences to the list 
> (if they exist) and remove the source areas.  I keep going until I've 
> compared every area against every other area and found no non-empty 
> intersections.
> One other thing that I found was the Overlaps can return true but the 
> intersection of the two polygons returns true for isEmpty?!?!?  (I was 
> using overlaps instead of intersects in the split_areas comparison)
> Thanks,
> Russell
> ------------------------------------------------------------------------
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel

Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

More information about the geos-devel mailing list