ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / SetAndInterpolateMsBetween Method
The multipart on which to set the M-values.
The beginning M-value.
The end M-value.
Example

In This Topic
    SetAndInterpolateMsBetween Method (IGeometryEngine)
    In This Topic
    Sets the Ms at the beginning and the end of the geometry and interpolates the M-values between these values.
    Syntax
    Multipart SetAndInterpolateMsBetween( 
       Multipart multipart,
       double fromM,
       double toM
    )
    Function SetAndInterpolateMsBetween( _
       ByVal multipart As Multipart, _
       ByVal fromM As Double, _
       ByVal toM As Double _
    ) As Multipart

    Parameters

    multipart
    The multipart on which to set the M-values.
    fromM
    The beginning M-value.
    toM
    The end M-value.

    Return Value

    The multipart with new M-values. If the input multipart is empty, then it is returned unchanged.
    Exceptions
    ExceptionDescription
    Multipart is null.
    This geometry is not M-Aware.
    The input fromM and toM are invalid and M-values cannot be interpolated.
    Spatial reference of multipartis an image coordinate system.
    Example
    Set Ms at the beginning and end of the geometry and interpolate M-values between the two values - SetAndInterpolateMsBetween
    string json = "{\"hasM\":true,\"paths\":[[[-3000,-2000],[-2000,-2000],[-1000,-2000],[0,-2000],[1000,-2000],[2000,-2000],[3000,-2000],[4000,-2000]]],\"spatialReference\":{\"wkid\":3857}}";
    Polyline polyline = PolylineBuilderEx.FromJson(json);
    
    Polyline outPolyline = GeometryEngine.Instance.SetAndInterpolateMsBetween(polyline, 100, 800) as Polyline;
    ReadOnlyPointCollection outPoints = outPolyline.Points;
    // outPoints M values are { 100, 200, 300, 400, 500, 600, 700, 800 };
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also