ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / MapPointBuilderEx Class / ID Property
Example Version

ID Property (MapPointBuilderEx)
Gets or sets the ID-coordinate.
Syntax
public int ID {get; set;}
Remarks
When the ID-value is set, the HasID property is set to true. If this builder is not ID-Aware, a default value of 0 is returned.
Example
Convert vertices in a polyline to a Control Point
//Control points are special vertices used to apply symbol effects to line or polygon features.
//By default, they appear as diamonds when you edit them.
//They can also be used to migrate representations from ArcMap to features in ArcGIS Pro.
QueuedTask.Run(() =>
{
  //iterate through the points in the polyline.
  var lineLayerCursor = lineLayer.GetSelection().Search();
  var lineVertices = new List<MapPoint>();
  long oid = -1;
  while (lineLayerCursor.MoveNext())
  {
    var lineFeature = lineLayerCursor.Current as Feature;
    var line = lineFeature.GetShape() as Polyline;
    int vertexIndex = 1;
    oid = lineFeature.GetObjectID();
    //Each point is converted into a MapPoint and gets added to a list. 
    foreach (var point in line.Points)
    {
      MapPointBuilderEx mapPointBuilderEx = new MapPointBuilderEx(point);
      //Changing the vertex 6 and 7 to control points
      if (vertexIndex == 6 || vertexIndex == 7)
      {
        //These points are made "ID Aware" and the IDs are set to be 1.
        mapPointBuilderEx.HasID = true;
        mapPointBuilderEx.ID = 1;
      }
      
      lineVertices.Add(mapPointBuilderEx.ToGeometry() as MapPoint);
      vertexIndex++;
    }
  }
  //create a new polyline using the point collection.
  var newLine = PolylineBuilderEx.CreatePolyline(lineVertices);
  //edit operation to modify the original line with the new line that contains control points.
  changeVertexIDOperation.Modify(lineLayer, oid, newLine);
  changeVertexIDOperation.Execute();
});
MapPoint Builder Properties
// MapPointBuilderEx constructors can run on any thread.

MapPoint point1 = null;
MapPoint point2 = null;

SpatialReference spatialReference = SpatialReferenceBuilder.CreateSpatialReference(54004);
        
MapPointBuilderEx mapPointBuilder = new MapPointBuilderEx(100, 200, spatialReference);
SpatialReference sr = mapPointBuilder.SpatialReference; // sr != null
int wkid = sr.Wkid; // wkid = 54004
bool hasZ = mapPointBuilder.HasZ;   // hasZ = false
bool hasM = mapPointBuilder.HasM;   // hasM = false
bool hasID = mapPointBuilder.HasID; // hasID = false
bool isEmpty = mapPointBuilder.IsEmpty; // isEmpty = false
double x = mapPointBuilder.X;   // x = 100
double y = mapPointBuilder.Y;   // y = 200
double z = mapPointBuilder.Z;   // z = 0, default value
double m = mapPointBuilder.M;   // m is NaN, default value
double id = mapPointBuilder.ID; // id = 0, default value

// Do something with the builder
mapPointBuilder.Z = 12; // Setting the z-value automatically sets HasZ property to true

point1 = mapPointBuilder.ToGeometry();
sr = point1.SpatialReference; // sr != null
wkid = sr.Wkid; // wkid = 54004
hasZ = point1.HasZ;   // hasZ = true
hasM = point1.HasM;   // hasM = false
hasID = point1.HasID; // hasID = false
x = point1.X;   // x = 100
y = point1.Y;   // y = 200
z = point1.Z;   // z = 12
m = point1.M;   // m is NaN, default value
id = point1.ID; // id = 0, default value

// Change some of the builder properties
mapPointBuilder.SetValues(11, 22);
mapPointBuilder.HasZ = false;
mapPointBuilder.HasM = true;
mapPointBuilder.M = 44;
        
// Create another point
point2 = mapPointBuilder.ToGeometry();

bool isEqual = point1.IsEqual(point2); // isEqual = false

// Set the builder to empty
// Sets X and Y to NaN. Sets other attributes to the default values.
// Does not change the attribute awareness.
mapPointBuilder.SetEmpty();

MapPoint point3 = mapPointBuilder.ToGeometry();
sr = point3.SpatialReference; // sr != null
wkid = sr.Wkid; // wkid = 54004
hasZ = point3.HasZ;        // hasZ = false
hasM = point3.HasM;        // hasM = true
hasID = point3.HasID;      // hasID = false
isEmpty = point3.IsEmpty;  // isEmpty = true
x = point3.X;              // x is NaN
y = point3.Y;              // y is NaN
z = point3.Z;              // z = 0, default value
m = point3.M;              // m is NaN, default value
id = point3.ID;            // ID = 0, default value

// Create a builder from a point
mapPointBuilder = new MapPointBuilderEx(point2); // point1 = (11, 22, 0, 44, 0)
sr = mapPointBuilder.SpatialReference; // sr != null
wkid = sr.Wkid; // wkid = 54004
hasZ = mapPointBuilder.HasZ;        // hasZ = false
hasM = mapPointBuilder.HasM;        // hasM = true
hasID = mapPointBuilder.HasID;      // hasID = false
isEmpty = mapPointBuilder.IsEmpty;  // isEmpty = false
x = mapPointBuilder.X;              // x = 11
y = mapPointBuilder.Y;              // y = 22
z = mapPointBuilder.Z;              // z = 0, default value
m = mapPointBuilder.M;              // m = 44
id = mapPointBuilder.ID;            // ID = 0, default value

// Setting attribute values automatically sets the corresponding flag to true
mapPointBuilder.Z = 150;
mapPointBuilder.ID = 2;

// Remove the spatial reference
mapPointBuilder.SpatialReference = null;
        
MapPoint point4 = mapPointBuilder.ToGeometry() as MapPoint;
sr = point3.SpatialReference; // sr = null
hasZ = point3.HasZ;        // hasZ = true
hasM = point3.HasM;        // hasM = true
hasID = point3.HasID;      // hasID = true
isEmpty = point3.IsEmpty;  // isEmpty = false
x = point3.X;              // x = 11
y = point3.Y;              // y = 22
z = point3.Z;              // z = 150
m = point3.M;              // m = 44
id = point3.ID;            // ID = 2
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also