I want to use the GeometryEngine.Instance.Cut method to cut one polyline with another. It works most of the times, except when the "cutter" polyline touches but does not crosses the "input" polyline.
Even if they do not cross each other, the two polylines still intersect, so I was expecting the cut to occur, according to the Cut method documentation :
"When a polyline/polygon is cut, it is split where it intersects the cutter polyline."
Is this behaviour by design or is it a bug ?
Solved! Go to Solution.
Matthias,
I see. Yes, it is a bug which will be fixed in the next release. SplitAtPoint is a good workaround in the meantime.
Thank you so much,
Annette
Hi Matthias,
The input polyline should be known simple before calling Cut. You can do this by calling either GeometryEngine.Instance.IsSimpleAsFeature (if you know that it is simple) or GeometryEngine.Instance.SimplifyAsFeature (if you're not sure if it is simple or not).
For future reference, if a GeometryEngine method throws a GeometryObjectException with the message "GeometryObjectException: The operation cannot be performed on a non-simple geometry.", then the geometry needs to be known simple.
The doc should explicitly mention this, so we will update it. Thank you for pointing it out.
Let me know if you have any questions.
Annette
Hi Annette, thank you for your answer.
In my case I already insure that my input polyline is simple prior to any Cut, so we can rule that out. Besides, I don't get an Exception when I cut the line. In the example above, the Cut method simply returns an IEnumerable<Geometry> of size two, with one empty element, and the second one is the input polyline unchanged.
I tried to perform the same operation without the SDK, just with the standard graphical tool Split, and the cut occur as I expect : the input polyline is divided in two parts, even if the cutter polyline doesn't cross.
I guess I'll have to work with the SplitAtPoint method of the SDK as a workaround, but I was just wondering if the behaviour I described was by design or if it was a bug. Please let me know if there is another possible workflow.
Matthias,
I see. Yes, it is a bug which will be fixed in the next release. SplitAtPoint is a good workaround in the meantime.
Thank you so much,
Annette