Simplifying a feature geometry (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Editing data > ArcGIS for Desktop editing for developers > Editing fundamentals > Simplifying a feature geometry (ArcObjects .NET 10.6 SDK)

Simplifying a feature geometry

About simplifying a feature geometry

When making changes to an existing feature, or when creating a feature, it is essential that the geometry that is stored with the feature be topologically correct (simple). ArcGIS assumes geometry retrieved from a feature is simple.
Geometry has a number of methods available to evaluate and force simplification of a geometry. Some of these methods are specific to a given geometry type, others perform a more specialized type of simplification.
The following code example takes an input geometry, simplifies the geometry based on its type, and returns the simplified geometry:
public IGeometry SimplifyGeometry(IGeometry geometry)
    if (geometry == null)
        return null;

    //Set the IsKnownSimple property to false, otherwise simplification will not take place.
    ITopologicalOperator2 topoOp=geometry as ITopologicalOperator2;

    switch (geometry.GeometryType)
        case esriGeometryType.esriGeometryMultipoint:
        case esriGeometryType.esriGeometryPolygon:
        case esriGeometryType.esriGeometryPolyline:
            if (geometry is IPolyline6)

    return geometry;
Public Function SimplifyGeometry(ByVal geometry As IGeometry) As IGeometry
    If geometry Is Nothing Then
        Return Nothing
    End If
    'Set the IsKnownSimple property to false, otherwise simplification will not take place.
    Dim topoOp As ITopologicalOperator2=TryCast(geometry, ITopologicalOperator2)
    Select Case geometry.GeometryType
        Case esriGeometryType.esriGeometryMultipoint
            Exit Select
        Case esriGeometryType.esriGeometryPolygon
            DirectCast(geometry, IPolygon).SimplifyPreserveFromTo()
            Exit Select
        Case esriGeometryType.esriGeometryPolyline
            If TypeOf geometry Is IPolyline6 Then
                DirectCast(geometry, IPolyline6).SimplifyNonPlanar()
                DirectCast(geometry, IPolyline).SimplifyNetwork()
            End If
            Exit Select
        Case Else
            Exit Select
    End Select
    Return geometry
End Function

See Also:

Calling the Simplify method
Simplifying a geometry

To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Basic ArcGIS Desktop Basic