I have some polygons that are quite big like having coordinates greater than 200k for those I have subdivided them into smaller pieces like this. (it was suggestion)
But still, some of the subdivided polygons have coordinates greater than 10k so for that I have used the triangulation like this.
DelaunayTriangulationBuilder delaunayTriangulationBuilder =
new DelaunayTriangulationBuilder();
delaunayTriangulationBuilder.setSites(dividedPieceOfGeometry);
Geometry triangles = delaunayTriangulationBuilder.getTriangles(geometryFactory);
IntStream.range(0, triangles.getNumGeometries())
.parallel()
.mapToObj(triangles::getGeometryN)
.map(geometryN -> geometryN.intersection(dividedPieceOfGeometry))
.flatMap(
possibleGeometryCollection -> {
List<Geometry> collectedGeometries = new ArrayList<>();
filterFromPossibleGeometries(possibleGeometryCollection, collectedGeometries); //this just extracts the geometries out of GeometryCollection
return collectedGeometries.stream();
})
.toList()
Now this whole process is quite time-consuming, and I wanted to improve the performance of this pre-processing.
I am using the JTS Topology Suite to implement this functionality.
Sample Polygon: This particular polygon has 6 million points in it.
