Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Struggling with polygon topology again. Overlapping inner polygons.



On Wed, Sep 21, 2016 at 3:09 PM, Phil Scadden <p.scadden@xxxxxxxxxx> wrote:

>Yes, that is one of the unfortunate issues that can happen when using buffer(0) to clean invalid geometry. In this case however it's less likely to happen (because the topology is "almost" valid - it only needs noding and having rings assigned correctly.)

I am struggling a little to understand what make topology "almost correct"

That can be defined more precisely:

1. For polygons which have "loops" in their shell, buffer(0) may FAIL because it keeps only one of the loops (and may choose the smaller one).
2. For polygons with rings that touch but do not cross, buffer(0) should produce VALID outputĀ 

Your case falls under #2.

I see the getArea works on invalid polygons so I have put in a filter to which compares areas before and after buffer(0). If "significantly" different, then revert to difference method.

That's a reasonable approach.


Back to the top