﻿ CalculateNonSimpleMs Method (GeometryEngine)—ArcGIS Pro
ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / CalculateNonSimpleMs Method
The multipart to calculate M-values for.
The value to which NaN M-values that could not be interpolated will be set.
Example

In This Topic
CalculateNonSimpleMs Method (GeometryEngine)
In This Topic
Calculates M attribute values for each non-simple (NaN) M-value from existing simple (non-NaN) M attributes on the specified geometry. The non-simple M values are obtained by extrapolation/interpolation for polylines and interpolation for polygons.
Syntax
```public Multipart CalculateNonSimpleMs(
Multipart multipart,
double defaultMValue
)```
```Public Function CalculateNonSimpleMs( _
ByVal multipart As Multipart, _
ByVal defaultMValue As Double _
) As Multipart```

#### Parameters

multipart
The multipart to calculate M-values for.
defaultMValue
The value to which NaN M-values that could not be interpolated will be set.

#### Return Value

A geometry in which each coordinate has a simple (non-NaN) M value.
Exceptions
ExceptionDescription
Multipart is null or empty.
This geometry is not M-Aware.
Example
Interpolate M values on a polygon
```List<MapPoint> coords = new List<MapPoint>()
{
MapPointBuilderEx.CreateMapPoint(0, 0, 0, 0),
MapPointBuilderEx.CreateMapPoint(0, 1000),
MapPointBuilderEx.CreateMapPoint(1000, 1000, 10, 50)
};

SpatialReference sr = SpatialReferences.WebMercator;

Polygon polygon = PolygonBuilderEx.CreatePolygon(coords, sr);

// polygon.HasM = true
// polygon.Points.HasM = true
// polygon.Points.M = NaN

Polygon polygonNoNaNMs = GeometryEngine.Instance.CalculateNonSimpleMs(polygon, 0) as Polygon;

// polygonNoNaNMs.Points.HasM = true
// polygonNoNaNMs.Points.M = 25  (halfway between 0 and 50)
```
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.