ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / NonSimpleReason Enumeration
Example Example

In This Topic
    NonSimpleReason Enumeration
    In This Topic
    Specifies the reason that a non-simple geometry is non-simple. Returned from GeometryEngine.GetNonSimpleReason. See SimplifyAsFeature and IsSimpleAsFeature Wiki page.
    Syntax
    Members
    MemberDescription
    DiscontinuousParts The geometry contains discontinuous parts.
    DuplicateVertex The geometry has one or more duplicate vertices.
    EmptyPart The geometry contains an empty part.
    EmptyZValues The geometry is z-aware, but one or more z-values are NaN.
    IsSimple The geometry is simple. Applies to all geometry types.
    MismatchedAttributes The geometry has mismatched attributes. All of the points must have the same attribute awareness. For example, if one point is z-aware and another point is not, then it has mismatched attributes.
    RingOrientation The rings of a polygon are oriented incorrectly. Exterior rings must be oriented clockwise, and interior rings must be oriented counterclockwise.
    SegmentOrientation Individual segments are not consistently oriented. The end point of segment(i) must be the same as the start point of segment(i + 1).
    SelfIntersections A path or ring intersects itself or other parts.
    ShortSegments Some segments are shorter than allowed by the system units of the spatial reference associated with the geometry.
    UnclosedRing A ring in a polygon is not closed. The end point of the last segment in a ring must be equal to the start point of the first segment in that ring.
    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
    
    SimplifyOgc
    
    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);
    // polyline.IsKnownSimpleOgc = false
    // polyline.IsKnownSimple = false
    
    NonSimpleReason nonSimpleReason;
    bool isSimple = GeometryEngine.Instance.IsSimpleOgc(polyline, out nonSimpleReason, true);
    // isSimple = false
    // nonSimpleReason = NonSimpleReason.SelfIntersections
    
    Polyline simplePolyline = GeometryEngine.Instance.SimplifyOgc(polyline) as Polyline;
    // simplePolyline.IsKnownSimpleOgc = true
    // simplePolyline.IsKnownSimple = true
    
    
    
    double resolution = sr.XYResolution;
    Coordinate3D[] coords3D = new Coordinate3D[] { new Coordinate3D(0, 0, 0), new Coordinate3D(0, 1.8 * resolution, 0.8 * sr.ZTolerance), new Coordinate3D(10, 10, 1),
      new Coordinate3D(0, 5, 1) };
    polyline = PolylineBuilderEx.CreatePolyline(coords3D, sr);
    
    isSimple = GeometryEngine.Instance.IsSimpleOgc(polyline, out nonSimpleReason);
    // isSimple = false
    // nonSimpleReason = NonSimpleReason.ShortSegments
    
    simplePolyline = GeometryEngine.Instance.SimplifyOgc(polyline, true) as Polyline;
    // simplePolyline.IsKnownSimpleOgc = true
    // simplePolyline.IsKnownSimple = true
    
    
    
    coords = new Coordinate2D[] { new Coordinate2D(0, 0), new Coordinate2D(0, 0) };
    Multipoint multipoint = MultipointBuilderEx.CreateMultipoint(coords, sr);
    
    isSimple = GeometryEngine.Instance.IsSimpleOgc(multipoint, out nonSimpleReason);
    // isSimple = false
    // nonSimpleReason = NonSimpleReason.DuplicateVertex
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.Geometry.NonSimpleReason

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also