ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / MapPointBuilderEx Class / CreateMapPoint Method / CreateMapPoint(MapPoint,SpatialReference) Method
Specifies the coordinates for the MapPoint.
(Optional) The SpatialReference. The default value is null. If null, the spatial reference of the input point is used.
Example

CreateMapPoint(MapPoint,SpatialReference) Method
Convenience method to create a MapPoint instance.
Syntax
public static MapPoint CreateMapPoint( 
   MapPoint point,
   SpatialReference spatialReference
)

Parameters

point
Specifies the coordinates for the MapPoint.
spatialReference
(Optional) The SpatialReference. The default value is null. If null, the spatial reference of the input point is used.

Return Value

Exceptions
ExceptionDescription
point is null.
Remarks
The HasZ, HasM, and HasID attributes are inherited from the input point.
Example
Construct a MapPoint
// Use a builder convenience method or use a builder constructor.

// create a 3d point with M
MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 2.0, 3.0, 4.0);


// builderEx constructors don't need to run on the MCT.
MapPointBuilderEx mb = new MapPointBuilderEx(1.0, 2.0, 3.0, 4.0);
// do something with the builder

MapPoint ptWithM = mb.ToGeometry();


MapPoint clone = ptWithM.Clone() as MapPoint;
MapPoint anotherM = MapPointBuilderEx.CreateMapPoint(ptWithM);


MapPointBuilderEx builderEx = new MapPointBuilderEx(1.0, 2.0, 3.0);
builderEx.HasM = true;
builderEx.M = 4.0;

pt = builderEx.ToGeometry() as MapPoint;


// or another alternative with builderEx constructor
builderEx = new MapPointBuilderEx(1.0, 2.0, true, 3.0, true, 4.0, false, 0);
pt = builderEx.ToGeometry() as MapPoint;


// or use a builderEx convenience method
pt = MapPointBuilderEx.CreateMapPoint(1.0, 2.0, 3.0, 4.0);
MapPoint Builder Properties
// Use a builderEx convenience method or a builderEx constructor.
//  neither need to run on the MCT.

MapPoint point1 = null;
MapPoint point2 = null;

MapPointBuilderEx mb = new MapPointBuilderEx(1.0, 2.0, 3.0);
bool bhasZ = mb.HasZ;          // hasZ = true
bool bhasM = mb.HasM;          // hasM = false
bool bhasID = mb.HasID;        // hasID = false

// do something with the builder

point1 = mb.ToGeometry();

// change some of the builder properties
mb.X = 11;
mb.Y = 22;
mb.HasZ = false;
mb.HasM = true;
mb.M = 44;
// create another point
point2 = mb.ToGeometry();

double x = point1.X;                  // x = 1.0
double y = point1.Y;                  // y = 2.0
double z = point1.Z;                  // z = 3.0
double m = point1.M;                  // m = Nan
int ID = point1.ID;                   // ID = 0
bool hasZ = point1.HasZ;              // hasZ = true
bool hasM = point1.HasM;              // hasM = false
bool hasID = point1.HasID;            // hasID = false
bool isEmpty = point1.IsEmpty;        // isEmpty = false

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


// BuilderEx convenience methods 
MapPoint point3 = MapPointBuilderEx.CreateMapPoint(point1);
x = point3.X;                   // x = 1.0
y = point3.Y;                   // y = 2.0
z = point3.Z;                   // z = 3.0
m = point3.M;                   // m = Nan
ID = point3.ID;                 // ID = 0
hasZ = point3.HasZ;             // hasZ = true
hasM = point3.HasM;             // hasM = false
hasID = point3.HasID;           // hasID = false


MapPointBuilderEx builderEx = new MapPointBuilderEx(point1);
x = builderEx.X;              // x = 1.0
y = builderEx.Y;              // y = 2.0
z = builderEx.Z;              // z = 3.0
m = builderEx.M;              // m = Nan
ID = builderEx.ID;            // ID = 0
hasZ = builderEx.HasZ;        // hasZ = true
hasM = builderEx.HasM;        // hasM = false
hasID = builderEx.HasID;      // hasID = false
isEmpty = builderEx.IsEmpty;     // isEmpty = false

MapPoint point4 = builderEx.ToGeometry() as MapPoint;


MapPoint point5 = MapPointBuilderEx.CreateMapPoint(point1);
x = point5.X;              // x = 1.0
y = point5.Y;              // y = 2.0
z = point5.Z;              // z = 3.0
m = point5.M;              // m = Nan
ID = point5.ID;            // ID = 0
hasZ = point5.HasZ;        // hasZ = true
hasM = point5.HasM;        // hasM = false
hasID = point5.HasID;      // hasID = false
isEmpty = point5.IsEmpty;     // isEmpty = false
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

ArcGIS Pro version: 2.8 or higher.
See Also