Select to view content in your preferred language

GeometryEngine Cut method inactive if polylines touches

612
3
Jump to solution
11-06-2022 06:39 PM
MatthiasBoucher
New Contributor II

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.

Cut.png

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 ?

0 Kudos
1 Solution

Accepted Solutions
AnnetteLocke
Esri Contributor

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

View solution in original post

3 Replies
AnnetteLocke
Esri Contributor

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

0 Kudos
MatthiasBoucher
New Contributor II

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.

0 Kudos
AnnetteLocke
Esri Contributor

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