ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipointBuilderEx Class / HasM Property
Example

In This Topic
    HasM Property (MultipointBuilderEx)
    In This Topic
    Gets or sets a value indicating if this instance recognizes M-values, also known as M-awareness.
    Syntax
    public override bool HasM {get; set;}
    Public Overrides NotOverridable Property HasM As Boolean
    Example
    Construct a Multipoint - using MultipointBuilderEx
    Coordinate2D[] coordinate2Ds = new Coordinate2D[] { new Coordinate2D(1, 2), new Coordinate2D(-1, -2) };
    SpatialReference sr = SpatialReferences.WGS84;
    
    MultipointBuilderEx builder = new MultipointBuilderEx(coordinate2Ds, sr);
    
    // builder.PointCount = 2
    
    builder.HasZ = true;
    // builder.Zs.Count = 2
    // builder.Zs[0] = 0
    // builder.Zs[1] = 0
    
    builder.HasM = true;
    // builder.Ms.Count = 2
    // builder.Ms[0] = NaN
    // builder.Ms[1] = NaN
    
    builder.HasID = true;
    // builder.IDs.Count = 2
    // builder.IDs[0] = 0
    // builder.IDs[1] = 0
    
    // set it empty
    builder.SetEmpty();
    // builder.Coords.Count = 0
    // builder.Zs.Count = 0
    // builder.Ms.Count = 0
    // builder.IDs.Count = 0
    
    
    // reset coordinates
    List<Coordinate2D> inCoords = new List<Coordinate2D>() { new Coordinate2D(1, 2), new Coordinate2D(3, 4), new Coordinate2D(5, 6) };
    builder.Coordinate2Ds = inCoords;
    // builder.Coords.Count = 3
    // builder.HasZ = true
    // builder.HasM = true
    // builder.HasID = true
    
    double[] zs = new double[] { 1, 2, 1, 2, 1, 2 };
    builder.Zs = zs;   
    // builder.Zs.Count = 6
    
    double[] ms = new double[] { 0, 1 };
    builder.Ms = ms;   
    // builder.Ms.Count = 2
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, NaN, 0)
    
    MapPoint mapPoint = builder.GetPoint(2);
    // mapPoint.HasZ = true
    // mapPoint.HasM = true
    // mapPoint.HasID = true
    // mapPoint.Z  = 1
    // mapPoint.M = NaN
    // mapPoint.ID = 0
    
    // add an M to the list
    builder.Ms.Add(2);
    // builder.Ms.count = 3
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, 2, 0)
    
    // now get the 2nd point again; it will now have an M value
    mapPoint = builder.GetPoint(2);
    // mapPoint.M = 2
    
    
    int[] ids = new int[] { -1, -2, -3 };
    // assign ID values
    builder.IDs = ids;
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (5, 6, 1, 2, -3)
    
    
    // create a new point
    MapPoint point = MapPointBuilderEx.CreateMapPoint(-300, 400, 4);
    builder.SetPoint(2, point);
    
    // coordinates are now   (x, y, z, m, id)
    //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (-300, 400, 4, NaN, 0)
    
    
    builder.RemovePoints(1, 3);
    // builder.PointCount = 1
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also