1

I'm doing a union of a large number of complicated polygons using nettopologysuite and it is very slow. As these polygons are perfectly tessellating is there something I can do to speed things up?

What I've tried so far

List<IGeometry> collection = GetLargeCollectionOfComplicatedMultiPolygons();

x = new NetTopologySuite.Operation.Union.UnaryUnionOp(collection).Union();//00:24:05

x = new NetTopologySuite.Operation.Union.CascadedPolygonUnion(collection).Union();//00:36:17

x = new GeometryCollection(collection.ToArray()).Buffer(0);//00:07:17

I've also tried to do stuff in parallel but it's not really helped.

3
  • How are you doing the union? Please, provide some code so we can see how to improve it. Jan 9, 2018 at 6:28
  • @cag code sample attached, the buffer(0) trick is the best I've found which I hadn't tried when I'd posted the question but I still feel this should be quicker given that the polygons perfectly tessellate.
    – dibs487
    Jan 9, 2018 at 9:15
  • You tried all the ways of union I know in NTS. There is one last thing you could try, but I've never tested it in NTS, so I don't know how it will perform. It requieres several steps. 1- Extract the segments of the polygons. 2- Remove the duplicate segments, so you keep only the boundary segments. 3- Polygonize the result. Jan 9, 2018 at 9:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.