﻿ OrientByMs Method (GeometryEngine)—ArcGIS Pro
ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / OrientByMs Method
The input polyline.
Example

In This Topic
OrientByMs Method (GeometryEngine)
In This Topic
Reorients the polyline such that all M-values are non-decreasing, if possible.
Syntax
```public Polyline OrientByMs(
Polyline polyline
)```
```Public 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