Saturday, 5 May 2018

geometry - How to find self-intersecting polylines using ArcObjects?


If I have a polyline, how do I figure out whether it is self-intersecting? I tried to use ITopologicalOperator.IsSimple Property, but it always returns true.


Are there any ways of doing these kind of topological checks over individual geometries?



Answer



I think you can do with with the ITopologicalOperator2 interface:


dim pTopoLogicalOp as ITopologicalOperator2
Set pPolyline = pFeature.ShapeCopy

Set pTopoLogicalOp = pPolyline
Let pTopoLogicalOp.IsKnownSimple = False
If pTopoLogicalOp.IsSimple = False Then
' Polyline is self intersecting
End If

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...