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

Russell Strong russell at strong.id.au
Thu Mar 6 05:17:10 EST 2008


I've done lots of C and python, never done any C++ programming before, 
looks like I'll be doing some learning.  Can't be too hard, right...

Martin Davis wrote:
> Er, well, perhaps not.  Can you use the C++ API instead?  Or else this 
> is a project for some GEOS developer...
>
> Russell Strong wrote:
>> I've had a look through the c api and it would appear that access to 
>> precision models is not exposed, unless it's disguised in a way I 
>> have not recognized.  Am I correct?  Is there some code that someone 
>> knows about which could give me some *pointers.
>>
>> Martin Davis wrote:
>>> 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
>>>
>>
>> _______________________________________________
>> geos-devel mailing list
>> geos-devel at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/geos-devel
>>
>



More information about the geos-devel mailing list