ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / GetNonSimpleReason Method
The geometry to be tested.
The reason that the geometry is non-simple.
(Optional) The default value is false. When true, the geometry will be tested for simplicity even if it has already been tested or simplified. Geometry has a non-persisted internal flag that is set by IsSimpleAsFeature or SimplifyAsFeature calls. The flag is used to avoid computations if the state of the geometry is known.
Example

In This Topic
    GetNonSimpleReason Method (IGeometryEngine)
    In This Topic
    Indicates whether this geometry is topologically correct.
    Syntax
    Function GetNonSimpleReason( _
       ByVal geometry As Geometry, _
       ByRef nonSimpleReason As NonSimpleReason, _
       Optional ByVal forceIsSimple As Boolean _
    ) As Boolean

    Parameters

    geometry
    The geometry to be tested.
    nonSimpleReason
    The reason that the geometry is non-simple.
    forceIsSimple
    (Optional) The default value is false. When true, the geometry will be tested for simplicity even if it has already been tested or simplified. Geometry has a non-persisted internal flag that is set by IsSimpleAsFeature or SimplifyAsFeature calls. The flag is used to avoid computations if the state of the geometry is known.

    Return Value

    Returns true if the geometry is simple. Otherwise, returns false.
    Exceptions
    ExceptionDescription
    Geometry is null.
    The method is not implemented for GeometryBag.
    Remarks
    Example
    Get Non Simple Reason
    SpatialReference sr = SpatialReferences.WGS84;
    Coordinate2D[] coords = new Coordinate2D[] { new Coordinate2D(5, 10), new Coordinate2D(15, 20), new Coordinate2D(25, 10), new Coordinate2D(5, 20) };
    Polyline polyline = PolylineBuilderEx.CreatePolyline(coords, sr);
    
    NonSimpleReason nonSimpleReason;
    bool isSimple = GeometryEngine.Instance.GetNonSimpleReason(polyline, out nonSimpleReason);
    // isSimple = true;
    // nonSimpleReason = NonSimpleReason.IsSimple
    
    
    double resolution = sr.XYResolution;
    coords = new Coordinate2D[] { new Coordinate2D(0, 0), new Coordinate2D(0, 1.8 * resolution), new Coordinate2D(10, 10), new Coordinate2D(0, 5) };
    polyline = PolylineBuilderEx.CreatePolyline(coords, sr);
    
    isSimple = GeometryEngine.Instance.GetNonSimpleReason(polyline, out nonSimpleReason);
    // isSimple = false
    // nonSimpleReason = NonSimpleReason.ShortSegments
    
    
    coords = new Coordinate2D[] { new Coordinate2D(10, 10), new Coordinate2D(10, 20), new Coordinate2D(40, 20),
    new Coordinate2D(40, 10), new Coordinate2D(60, 10), new Coordinate2D(70, 10)};
    
    Polygon polygon = PolygonBuilderEx.CreatePolygon(coords, sr);
    
    isSimple = GeometryEngine.Instance.GetNonSimpleReason(polygon, out nonSimpleReason);
    //isSimple = false
    //nonSimpleReason = NonSimpleReason.SelfIntersections
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also