-
What is the best approach to preserve the faces of a multipolygon when it is intersected with a polygon? One approach of course is to intersect each polygon of the multipolygon with the target individually, but is there a more appropriate/faster way? ExampleMultiPolygon......intersected with:Desired outputActual output |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Actually that doesn't look like a valid MultiPolygon, since the faces are edge-adjacent. It should be represented as a GeometryCollection, or a an array or List of Polygons. The usual process for doing this is called Polygon Coverage Overlay. JTS doesn't currently have a class that does this (although I hope to implement one medium-term). But it can be constructed by using noding and polygonization. There is a simple implementation here. If you want to keep only the resultants in the polygon B, you can use Point-In-Polygon tests to do that. Performing overlay as a bulk process should be faster than performing a series of individual intersection operations, primarily due to the lower overhead of noding the linework in a single step, rather than many separate ones. |
Beta Was this translation helpful? Give feedback.
Actually that doesn't look like a valid MultiPolygon, since the faces are edge-adjacent. It should be represented as a GeometryCollection, or a an array or List of Polygons.
The usual process for doing this is called Polygon Coverage Overlay. JTS doesn't currently have a class that does this (although I hope to implement one medium-term). But it can be constructed by using noding and polygonization. There is a simple implementation here. If you want to keep only the resultants in the polygon B, you can use Point-In-Polygon tests to do that.
Performing overlay as a bulk process should be faster than performing a series of individual intersection operations, primarily due to the lower overh…