ArcGIS Pro 2.6 API Reference Guide
CalibrateByMs Method (GeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class : CalibrateByMs Method
The multipart to copy and update.
The points with the new M values. If the X and Y values match a point in the multipart, then the M value of that point will be updated with the M value of the input point.
The method to use when updating M values of points that are not included in points. You can use a combination of update methods by using the bitwise OR operator. For example, to interpolate between the input points and to extrapolate before the input points, use UpdateMMethod.Interpolate | UpdateMMethod.ExtrapolateBefore.
The distance along the multipart that determines if points are considered for calibration. Points that are farther than the distance along the multipart are not calibrated. If you want all the points to be considered for calibration, use the length of the multipart.
Calibrates M values using M values of input points.
Syntax

Parameters

multipart
The multipart to copy and update.
points
The points with the new M values. If the X and Y values match a point in the multipart, then the M value of that point will be updated with the M value of the input point.
updateHow
The method to use when updating M values of points that are not included in points. You can use a combination of update methods by using the bitwise OR operator. For example, to interpolate between the input points and to extrapolate before the input points, use UpdateMMethod.Interpolate | UpdateMMethod.ExtrapolateBefore.
cutOffDistance
The distance along the multipart that determines if points are considered for calibration. Points that are farther than the distance along the multipart are not calibrated. If you want all the points to be considered for calibration, use the length of the multipart.

Return Value

An updated version of the input multipart.
Exceptions
ExceptionDescription
The input multipart is null.
The input multipart is not M-aware.
Example
string json = "{\"hasM\":true,\"paths\":[[[0,0,-1],[1,0,0],[1,1,1],[1,2,2],[3,1,3],[5,3,4],[9,5,5],[7,6,6]]],\"spatialReference\":{\"wkid\":4326}}";
Polyline polyline = PolylineBuilder.FromJson(json);

// Interpolate using points (0, 0, 17), (1, 0, 42), (7, 6, 18) 
List<MapPoint> updatePoints = new List<MapPoint>(3);
MapPointBuilderEx builder = new MapPointBuilderEx(0, 0);
builder.M = 17;
updatePoints.Add(builder.ToGeometry() as MapPoint);

builder.X = 1;
builder.M = 42;
updatePoints.Add(builder.ToGeometry() as MapPoint);

builder.X = 7;
builder.Y = 6;
builder.M = 18;
updatePoints.Add(builder.ToGeometry() as MapPoint);

// Calibrate all the points in the polyline
double cutOffDistance = polyline.Length;

Polyline updatedPolyline = GeometryEngine.Instance.CalibrateByMs(polyline, updatePoints, UpdateMMethod.Interpolate, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0, 0, 17 ), ( 1, 0, 42 ), ( 1, 1, 38 ), ( 1, 2, 34 ), ( 3, 1, 30 ), ( 5, 3, 26 ), ( 9, 5, 22 ), ( 7, 6, 18 )

// ExtrapolateBefore using points (1, 2, 42), (9, 5, 18)
builder.X = 1;
builder.Y = 2;
builder.M = 42;
updatePoints[0] = builder.ToGeometry() as MapPoint;

builder.X = 9;
builder.Y = 5;
builder.M = 18;
updatePoints[1] = builder.ToGeometry() as MapPoint;

updatePoints.RemoveAt(2);

updatedPolyline = GeometryEngine.Instance.CalibrateByMs(polyline, updatePoints, UpdateMMethod.ExtrapolateBefore, cutOffDistance) as Polyline;
// The points in the updated polyline are
// ( 0, 0, 66 ), ( 1, 0, 58 ), ( 1, 1, 50 ), ( 1, 2, 42 ), ( 3, 1, 3 ), ( 5, 3, 4 ), ( 9, 5, 18 ), ( 7, 6, 6 )

// ExtrapolateAfter using points (0, 0, 17), (1, 2, 42)
builder.X = 0;
builder.Y = 0;
builder.M = 17;
updatePoints.Insert(0, builder.ToGeometry() as MapPoint);

updatePoints.RemoveAt(2);

updatedPolyline = GeometryEngine.Instance.CalibrateByMs(polyline, updatePoints, UpdateMMethod.ExtrapolateAfter, cutOffDistance) as Polyline;
// The points in the updated polyline are
// ( 0, 0, 17 ), ( 1, 0, 0 ), ( 1, 1, 1 ), ( 1, 2, 42 ), ( 3, 1, 50.333333333333333 ), ( 5, 3, 58.666666666666671 ), ( 9, 5, 67 ), ( 7, 6, 75.333333333333343 )

// ExtrapolateAfter and Interpolate using points (0, 0, 17), (1, 2, 42)
updatedPolyline = GeometryEngine.Instance.CalibrateByMs(polyline, updatePoints, UpdateMMethod.ExtrapolateAfter | UpdateMMethod.Interpolate, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0,0,17),(1,0,25.333333333333336),(1,1,33.666666666666671),(1,2,42),(3,1,50.333333333333336),(5,3,58.666666666666671),(9,5,67),(7,6,75.333333333333343)
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

GeometryEngine Class
GeometryEngine Members