ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / CalibrateMsByDistance 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.
Determines whether distances between parts of the polyline should be ignored or not.
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.
Example Version

CalibrateMsByDistance Method (GeometryEngine)
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.
updateMMethod
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.
ignoreGaps
Determines whether distances between parts of the polyline should be ignored or not.
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
Calibrate M-values using segment lengths and M values from input points - CalibrateMsByDistance
List<MapPoint> points = new List<MapPoint>();

MapPointBuilderEx pointBuilder = new MapPointBuilderEx(0, 0);
pointBuilder.HasM = true;
pointBuilder.M = 0;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 8);
pointBuilder.M = 12;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 18);
pointBuilder.M = 10;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 28);
pointBuilder.M = 14;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 32);
pointBuilder.M = 20;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 38);
pointBuilder.M = 26;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 50);
pointBuilder.M = 30;
points.Add(pointBuilder.ToGeometry());

Polyline polyline = PolylineBuilderEx.CreatePolyline(points, AttributeFlags.HasM);
// The points in the polyline are (0, 0, 0), (0, 8, 12), (0, 18, 10), (0, 28, 14), (0, 32, 20), (0, 38, 26), (0, 50, 30)

// Calibrate Ms using points (0, 8, 15), (0, 28, 30), (0, 38, 20)
points.Clear();
pointBuilder.SetValues(0, 8);
pointBuilder.M = 15;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 28);
pointBuilder.M = 30;
points.Add(pointBuilder.ToGeometry());

pointBuilder.SetValues(0, 38);
pointBuilder.M = 20;
points.Add(pointBuilder.ToGeometry());

double cutOffDistance = polyline.Length;

// ExtrapolateBefore
Polyline updatedPolyline = GeometryEngine.Instance.CalibrateMsByDistance(polyline, points, UpdateMMethod.ExtrapolateBefore, true, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0, 0, 9), (0, 8, 15), (0, 18, 10), (0, 28, 30), (0, 32, 20), (0, 38, 20), (0, 50, 30)

// Interpolate
updatedPolyline = GeometryEngine.Instance.CalibrateMsByDistance(polyline, points, UpdateMMethod.Interpolate, true, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0, 0, 0), (0, 8, 15), (0, 18, 22.5), (0, 28, 30), (0, 32, 26), (0, 38, 20), (0, 50, 30)

// ExtrapolateAfter
updatedPolyline = GeometryEngine.Instance.CalibrateMsByDistance(polyline, points, UpdateMMethod.ExtrapolateAfter, true, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0, 0, 0), (0, 8, 15), (0, 18, 10), (0, 28, 30), (0, 32, 20), (0, 38, 20), (0, 50, 8)

// ExtrapolateBefore and Interpolate and ExtrapolateAfter
updatedPolyline = GeometryEngine.Instance.CalibrateMsByDistance(polyline, points, UpdateMMethod.ExtrapolateAfter, true, cutOffDistance) as Polyline;
// The points in the updated polyline are
// (0, 0, 9), (0, 8, 15), (0, 18, 22.5), (0, 28, 30), (0, 32, 26), (0, 38, 20), (0, 50, 8)
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.3 or higher.
See Also