I have two linear rings, A (green) and B (red). I want to include all intersection points between two geometries in A.

enter image description here

In fact what I need is (A-B)+(A.B) (or maybe just A+(A.B)), but those operations may get too time consuming. The other option is to iterate over A's segments and find their intersections with B and construct a new linear ring from scratch. Now there might be many special cases that I need to cover. So, are there any other fast and robust options in NetTopologySuite?

  • 1
    The nice thing about small libraries is that they're small. It's also the bad thing about small libraries. Keep in mind that intersection returns a collection when there's linear overlap. Your problem is greatly simplified if you only have to find intersection with a rectangle. – Vince Jun 20 at 13:05

Have you tried the MCIndexNoder? It can generate the nodes at intersections efficiently, but you have to extract the segments of your geometries, node the segments with the MCIndexNoder and reconstruct the geometries.

Here is a recent post of Martin Davis (JTS creator) on noding strategies. Maybe you could find it interesting:


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.