ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / OrientByMs Method
The input polyline.
Example

In This Topic
    OrientByMs Method (IGeometryEngine)
    In This Topic
    Reorients the polyline such that all M-values are non-decreasing, if possible.
    Syntax
    Polyline OrientByMs( 
       Polyline polyline
    )
    Function OrientByMs( _
       ByVal polyline As Polyline _
    ) As Polyline

    Parameters

    polyline
    The input polyline.

    Return Value

    The reoriented polyline.
    Exceptions
    ExceptionDescription
    Polyline is null.
    This geometry is not M-Aware.
    Remarks
    If a part of the polyline is not monotonic, then that part is not changed.
    Example
    Reorient a polyine such that all M-values are non-decreasing, if possible - OrientByMs
    string json = "{\"hasM\":true,\"paths\":[[[0,0,1],[0,1,0],[1,1,-1],[1,0,-2]]]}";
    Polyline polyline = PolylineBuilderEx.FromJson(json);
    
    Polyline outputPolyline = GeometryEngine.Instance.OrientByMs(polyline);
    // The points of outputPolyline are (x, y, m): (1, 0, -2), (1, 1, -1), (0, 1, 0), (0, 0, 1)
    
    // M-values of second part is not monotonic, so it won't change. The first part will change.
    json = "{\"hasM\":true,\"paths\":[[[0,0,1],[0,1,0],[1,1,-1],[1,0,-2]],[[5,4,6],[6,4,5],[8,6,7]]]}";
    polyline = PolylineBuilderEx.FromJson(json);
    outputPolyline = GeometryEngine.Instance.OrientByMs(polyline);
    // The points of part 0 of outputPolyline are (x, y, m): (1, 0, -2), (1, 1, -1), (0, 1, 0), (0, 0, 1)
    // The points of part 1 of outputPolyline are (x, y, m): (5, 4, 6), (6, 4, 5), (8, 6, 7)
         
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.3 or higher.
    See Also