ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / UpdateAllMsByMs Method
The input polyline.
Determines whether to start measuring distance from the start or end of the polyline part. Measurement starts at the start or end point that is closest to origin.
The value by which the cumulative length of the polyline is multiplied.
The value that is added to the scaled cumulative length of the polyline.
Determines whether distances between parts of the polyline should be ignored or not.
Example

In This Topic
    UpdateAllMsByMs Method (GeometryEngine)
    In This Topic
    Updates M-values on all vertices as scaled and offset distances based on existing M-values.
    Syntax
    Public Function UpdateAllMsByMs( _
       ByVal polyline As Polyline, _
       ByVal origin As Coordinate2D, _
       ByVal scale As Double, _
       ByVal offset As Double, _
       ByVal ignoreGaps As Boolean _
    ) As Polyline

    Parameters

    polyline
    The input polyline.
    origin
    Determines whether to start measuring distance from the start or end of the polyline part. Measurement starts at the start or end point that is closest to origin.
    scale
    The value by which the cumulative length of the polyline is multiplied.
    offset
    The value that is added to the scaled cumulative length of the polyline.
    ignoreGaps
    Determines whether distances between parts of the polyline should be ignored or not.

    Return Value

    Polyline with M-values set. If the input polyline is empty, then it is returned unchanged.
    Exceptions
    ExceptionDescription
    The input polyline is null.
    The geometry is not M-Aware.
    The x-value or y-value of the origin is NaN.
    Example
    Set the M-values of the vertices as scaled and offset M distances measured along a polyline - UpdateAllMsByMs
    string json = "{\"hasM\":true,\"paths\":[[[-8,2,1],[-8,5,8],[-5,5,0],[-5,7,12]],[[3,2,20],[7,2,30],[7,4,10],[13,4,5]]]}";
    Polyline polyline = PolylineBuilderEx.FromJson(json);
    Coordinate2D origin = new Coordinate2D(-5, 6);
    
    Polyline outputPolyline = GeometryEngine.Instance.UpdateAllMsByMs(polyline, origin, 1, 0, true);
    // The xy-coordinates don't change. 
    // The M-values of the vertices in part 0 of outputPolyline are { 27, 20, 12, 0 }
    // The M-values of the vertices in part 1 of outputPolyline are { 27, 37, 57, 62 }
    
    outputPolyline = GeometryEngine.Instance.UpdateAllMsByMs(polyline, origin, 2, 4, true);
    // The M-values of the vertices in part 0 of outputPolyline are { 58, 44, 28, 4 }
    // The M-values of the vertices in part 1 of outputPolyline are { 58, 78, 118, 128 }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.3 or higher.
    See Also