ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / SetMsAsDistance Method
The multipart in which to set the M values.
Indicates whether the M values are set as lengths or ratios along the multipart.
Example

In This Topic
    SetMsAsDistance Method (IGeometryEngine)
    In This Topic
    Sets the M values to the cumulative length from the start of the multipart.
    Syntax

    Parameters

    multipart
    The multipart in which to set the M values.
    asRatioOrLength
    Indicates whether the M values are set as lengths or ratios along the multipart.

    Return Value

    Multipart with M values set.
    Exceptions
    ExceptionDescription
    Multipart is null or empty.
    This geometry is not M-Aware.
    Spatial reference of multipartis an image coordinate system.
    Example
    Set M values to the cumulative length from the start of the multipart - SetMsAsDistance
    string json = "{\"hasM\":true,\"rings\":[[[0,0],[0,3000],[4000,3000],[4000,0],[0,0]]],\"spatialReference\":{\"wkid\":3857}}";
    Polygon polygon = PolygonBuilderEx.FromJson(json);
    
    Polygon outPolygon = GeometryEngine.Instance.SetMsAsDistance(polygon, AsRatioOrLength.AsLength) as Polygon;
    ReadOnlyPointCollection outPoints = outPolygon.Points;
    // outPoints M values are { 0, 3000, 7000, 10000, 14000 };
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also