We're using the library NetTopologySuite
to work with geometries/(multi)polygons (in C#).
At some point, we need both the 'union' AND 'intersection' of two geometries (functionally we want the union of the two geometries and determine the duplicate parts of that union).
I know I can get a union using CascadedPolygonUnion.Union(new List<Geometry> { geometry1, geometry2 }))
and the intersection using geometry1.Intersection(geometry2)
.
But since the 'intersection' of the two polygons is basically the 'duplicated' part for a union, isn't there a routine that will determine the intersection AND the union in one function call?
Ex.
var result = GetUnionAndIntersection(geometry1, geometry2)
result.Union;
result.Intersection;
The main reason for the question is the assumption that there might be such a routine because it would perform faster than the two individual routines as the routine share some common knowledge about the duplicate area(s)...