Package com.github.micycle1.geoblitz
Class HilbertParallelPolygonUnion
java.lang.Object
com.github.micycle1.geoblitz.HilbertParallelPolygonUnion
High-performance polygon union built on Hilbert-ordered batching and parallel
reduction.
This utility provides a faster alternative to JTS's
CascadedPolygonUnion for large collections by:
- sorting inputs in-place by a Hilbert space-filling-curve key derived from their envelopes, improving spatial locality of subsequent unions; and
- performing the union as a parallel reduction using Java streams.
Notes:
- The input list is reordered in-place.
- The list must be non-empty; the result
GeometryFactoryis taken from the first element.
- Author:
- Michael Carleton
- See Also:
-
CascadedPolygonUnion
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.locationtech.jts.geom.GeometryComputes the union of the provided geometries using Hilbert-order sorting and a parallel reduction.static org.locationtech.jts.geom.Geometryunion(org.locationtech.jts.geom.Geometry geom) Computes the union of the provided geometry using Hilbert-order sorting and a parallel reduction.
-
Method Details
-
union
public static org.locationtech.jts.geom.Geometry union(org.locationtech.jts.geom.Geometry geom) Computes the union of the provided geometry using Hilbert-order sorting and a parallel reduction.The input geometries are first sorted in-place by a Hilbert curve key computed from each geometry's envelope to cluster nearby geometries. The union is then evaluated in parallel.
Any non-polygonal components produced during union are discarded, and the returned geometry is guaranteed to be polygonal:
- a
Polygonif the result contains a single polygon, or - a
MultiPolygonif multiple polygons remain.
GeometryFactoryof the first input geometry.- Parameters:
geom- a geometry (intended for Polygon collection or MultiPolygon)- Returns:
- a polygonal geometry representing the union (Polygon or MultiPolygon)
- a
-
union
public static org.locationtech.jts.geom.Geometry union(List<org.locationtech.jts.geom.Geometry> geoms) Computes the union of the provided geometries using Hilbert-order sorting and a parallel reduction.The input list is first sorted in-place by a Hilbert curve key computed from each geometry's envelope to cluster nearby geometries. The union is then evaluated in parallel.
Any non-polygonal components produced during union are discarded, and the returned geometry is guaranteed to be polygonal:
- a
Polygonif the result contains a single polygon, or - a
MultiPolygonif multiple polygons remain.
GeometryFactoryof the first input geometry.- Parameters:
geoms- a non-null, non-empty list of geometries (intended for Polygon or MultiPolygon)- Returns:
- a polygonal geometry representing the union (Polygon or MultiPolygon)
- a
-