Class OverlapUnion
- java.lang.Object
-
- org.locationtech.jts.operation.union.OverlapUnion
-
public class OverlapUnion extends java.lang.Object
Unions MultiPolygons efficiently by using full topological union only for polygons which may overlap by virtue of intersecting the common area of the inputs. Other polygons are simply combined with the union result, which is much more performant.This situation is likely to occur during cascaded polygon union, since the partitioning of polygons is done heuristically and thus may group disjoint polygons which can lie far apart. It may also occur in real world data which contains many disjoint polygons (e.g. polygons representing parcels on different street blocks).
Algorithm
The overlap region is determined as the common envelope of intersection. The input polygons are partitioned into two sets:- Overlapping: Polygons which intersect the overlap region, and thus potentially overlap each other
- Disjoint: Polygons which are disjoint from (lie wholly outside) the overlap region
Verification
In the general case the Overlapping set of polygons will extend beyond the overlap envelope. This means that the union result will extend beyond the overlap region. There is a small chance that the topological union of the overlap region will shift the result linework enough that the result geometry intersects one of the Disjoint geometries. This case is detected and if it occurs is remedied by falling back to performing a full union of the original inputs. Detection is done by a fairly efficient comparison of edge segments which extend beyond the overlap region. If any segments have changed then there is a risk of introduced intersections, and full union is performed.This situation has not been observed in JTS using floating precision, but it could happen due to snapping. It has been observed in other APIs (e.g. GEOS) due to more aggressive snapping. And it will be more likely to happen if a snap-rounding overlay is used.
- Author:
- mbdavis
-
-
Constructor Summary
Constructors Constructor Description OverlapUnion(Geometry g0, Geometry g1)
Creates a new instance for unioning the given geometries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometry
union()
Unions the input geometries, using the more performant overlap union algorithm if possible.static Geometry
union(Geometry g0, Geometry g1)
Union a pair of geometries, using the more performant overlap union algorithm if possible.
-
-
-
Method Detail
-
union
public static Geometry union(Geometry g0, Geometry g1)
Union a pair of geometries, using the more performant overlap union algorithm if possible.- Parameters:
g0
- a geometry to uniong1
- a geometry to union- Returns:
- the union of the inputs
-
union
public Geometry union()
Unions the input geometries, using the more performant overlap union algorithm if possible.- Returns:
- the union of the inputs
-
-