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.


In TestBuilder are you working with LinearRings or Polygons? If you are using rings then yes, subtracting one ring from another outside it is just going to return the outer ring. (Rings don't have area).
Outer was definitely polygon, but inner may have been rings.

When I subtract the first hole polygon from the shell polygon I get a polygon with one hole, as expected. I'm not sure why the original code doesn't work, however. Probably something obvious that neither of us is seeing. Are the intermediate results at all correct?
No. The difference was having no effect. I will have another look at it. Should probably fetch the jts source and have a closer look.
Another way to do this is to form the polygon with the holes (which will be invalid), and then run buffer(0) on it. That has the effect of fixing the topology. It's quite fast. Not 100% robust, but should be fine if the polygon geometry is "relatively clean" (which is hard to define more precisely!)
I have avoided this because I found I could have a small self-crossing with it keeping the small polygon and destroying the main geometry.Because I am bulk processing, it can be hard to detect this happening. Hadnt tried it for issue of crossing inner polygon though. Speed doesnt worry me so much ( I dont care if runs all night), but maximizing the accuracy of the reconstruction does.

--
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



Back to the top