ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Weed Method
The multipart to generalize.
The maximum deviation used to calculate the deviation used in the Douglas-Peucker generalization algorithm. Cannot be NaN. If maxDeviation is > 0, then internal deviation = maxDeviation * internal tolerance. If maxDeviation is <= 0, then internal deviation = 10000.0 * internal tolerance.
Example

In This Topic
    Weed Method (GeometryEngine)
    In This Topic
    Generalizes the multipart using a small tolerance based upon either the units of the geometry's spatial reference or the geometry's bounding box.
    Syntax
    Public Function Weed( _
       ByVal multipart As Multipart, _
       ByVal maxDeviation As Double _
    ) As Multipart

    Parameters

    multipart
    The multipart to generalize.
    maxDeviation
    The maximum deviation used to calculate the deviation used in the Douglas-Peucker generalization algorithm. Cannot be NaN. If maxDeviation is > 0, then internal deviation = maxDeviation * internal tolerance. If maxDeviation is <= 0, then internal deviation = 10000.0 * internal tolerance.

    Return Value

    The generalized multipart.
    Exceptions
    ExceptionDescription
    The input multipart is null.
    The maxDeviation parameter is NaN.
    Remarks
    For a multipart with non-linear segments, the output multipart may contain more vertices than the input multipart, but all output segments will be linear.
    Example
    Generalize a multipart - Weed
    // generalize with a maxDeviation of 0
    Polyline weedPolyline = GeometryEngine.Instance.Weed(polyline, 0) as Polyline;
    
    // generalize with a maxDeviation < 0
    weedPolyline = GeometryEngine.Instance.Weed(polyline, -1000000) as Polyline;
    
    // generalize with a maxDeviation > 0
    weedPolyline = GeometryEngine.Instance.Weed(polyline, 1000000) as Polyline;
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.5 or higher.
    See Also