Re: bad input data or robustness issue?
Russell Strong <russell <at> strong.id.au>
2008-03-06 10:17:10 GMT
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