ArcGIS Pro 3.4 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 Version

CalculateNonSimpleMs Method (GeometryEngine)
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
)

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[1].HasM = true
// polygon.Points[1].M = NaN

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

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

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also