﻿ GetMsAtDistance Method (GeometryEngine)—ArcGIS Pro
ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / GetMsAtDistance Method
The multipart from which to get the M-values.
The distance along the multipart to retrieve the M-values.
Indicates whether the distance should be interpreted as length or ratio along the multipart.
The M-value at the specified distance.
The second M-value, if there is one. If the specified distance is not at the beginning or the ending of a part, then this value is NaN.
Example

In This Topic
GetMsAtDistance Method (GeometryEngine)
In This Topic
Get the M-values at the specified distance along the multipart. Two M-values can be returned if the specified distance is exactly at the beginning or the ending of a part.
Syntax
```public void GetMsAtDistance(
Multipart multipart,
double distance,
AsRatioOrLength asRatioOrLength,
out double mValue1,
out double mValue2
)```
```Public Sub GetMsAtDistance( _
ByVal multipart As Multipart, _
ByVal distance As Double, _
ByVal asRatioOrLength As AsRatioOrLength, _
ByRef mValue1 As Double, _
ByRef mValue2 As Double _
) ```

#### Parameters

multipart
The multipart from which to get the M-values.
distance
The distance along the multipart to retrieve the M-values.
asRatioOrLength
Indicates whether the distance should be interpreted as length or ratio along the multipart.
mValue1
The M-value at the specified distance.
mValue2
The second M-value, if there is one. If the specified distance is not at the beginning or the ending of a part, then this value is NaN.
Exceptions
ExceptionDescription
The input multipart is null.
The input multipart is not M-Aware.
Remarks
If the input multipart is empty, then both mValue1 and mValue2 are NaN.
Example
Get the M values at the specified distance along the multipart
```string json = "{\"hasM\":true,\"paths\":[[[-3000,-2000,-3],[-2000,-2000,-2]],[[-2000,-2000,1],[-2000,1000,2]]],\"spatialReference\":{\"wkid\":3857}}";
Polyline polyline = PolylineBuilderEx.FromJson(json);

// polyline has 2 parts

double m1, m2;
GeometryEngine.Instance.GetMsAtDistance(polyline, 0, AsRatioOrLength.AsLength, out m1, out m2);
// m1 = -3
// m2 = NaN

GeometryEngine.Instance.GetMsAtDistance(polyline, 500, AsRatioOrLength.AsLength, out m1, out m2);
// m1 = -2.5
// m2 = NaN

GeometryEngine.Instance.GetMsAtDistance(polyline, 1000, AsRatioOrLength.AsLength, out m1, out m2);
// m1 = -2
// m2 = 1     // m2 has a value because distance 1000 is at the end of the first part, beginning of the second part
```
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.