﻿ UpdateMsByMs Method (GeometryEngine)—ArcGIS Pro
ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / UpdateMsByMs Method
The input polyline.
The index of the part from which to start.
The index of the point (relative to the part) from which to start.
The index of the part from which to end.
The index of the point (relative to the part) from which to end.
The start M-value.
The end M-value.
The method to use when updating M-values. 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, useUpdateMMethod.Interpolate | UpdateMMethod.ExtrapolateBefore.
Example

In This Topic
UpdateMsByMs Method (GeometryEngine)
In This Topic
Updates M-values along the shortest path between the specified vertices. The interpolation ratio is determined by the existing M-values along that path and the input M-values.
Syntax
```public Polyline UpdateMsByMs(
Polyline polyline,
int fromPartIndex,
int fromPointIndex,
int toPartIndex,
int toPointIndex,
double fromM,
double toM,
UpdateMMethod updateMMethod
)```
```Public Function UpdateMsByMs( _
ByVal polyline As Polyline, _
ByVal fromPartIndex As Integer, _
ByVal fromPointIndex As Integer, _
ByVal toPartIndex As Integer, _
ByVal toPointIndex As Integer, _
ByVal fromM As Double, _
ByVal toM As Double, _
ByVal updateMMethod As UpdateMMethod _
) As Polyline```

#### Parameters

polyline
The input polyline.
fromPartIndex
The index of the part from which to start.
fromPointIndex
The index of the point (relative to the part) from which to start.
toPartIndex
The index of the part from which to end.
toPointIndex
The index of the point (relative to the part) from which to end.
fromM
The start M-value.
toM
The end M-value.
updateMMethod
The method to use when updating M-values. 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, useUpdateMMethod.Interpolate | UpdateMMethod.ExtrapolateBefore.

#### Return Value

A polyline with updated M-values. 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 spatial reference is an image coordinate system.
fromPartIndex or fromPointIndex or toPartIndex or toPointIndex is negative.
toPartIndex is less than fromPartIndex.
The extrapolation range is invalid.
fromPartIndex or toPartIndex is greater than or equal to the number of parts in the multipart.
fromPointIndex or toPointIndex is greater than or equal to the number of points in the specified part.
Example
Update M-values with the interpolation ratio determined by existing M-values and the input M-values - UpdateMsByMs
```string json = "{\"hasM\":true,\"paths\":[[[-8,2,1],[-8,5,8],[-5,5,0],[-5,7,12]]],\"spatialReference\":{\"wkid\":4326}}";
Polyline polyline = PolylineBuilderEx.FromJson(json);

Polyline outputPolyline = GeometryEngine.Instance.UpdateMsByMs(polyline, 0, 1, 0, 3, -2, 14, UpdateMMethod.Interpolate);
// The xy-coordinates don't change.
// The M-values of the vertices in outputPolyline are (x, y, m): { 1, -2, 30, 14 }
```
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.3 or higher.