ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / MapPointBuilderEx Class / CreateMapPoint Method / CreateMapPoint(Double,Double,SpatialReference) Method
X coordinate.
Y coordinate.
(Optional) The SpatialReference. The default value is null.
Example

CreateMapPoint(Double,Double,SpatialReference) Method
Convenience method to create a MapPoint instance with the given X and Y coordinates.
Syntax
public static MapPoint CreateMapPoint( 
   double x,
   double y,
   SpatialReference spatialReference
)

Parameters

x
X coordinate.
y
Y coordinate.
spatialReference
(Optional) The SpatialReference. The default value is null.

Return Value

Example
Construct a Polyline - from an enumeration of MapPoints
// Use a builderEx convenience method or a builderEx constructor.
// neither need to run on the MCT

MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 1.0);

List<MapPoint> list = new List<MapPoint>();
list.Add(startPt);
list.Add(endPt);

Polyline polyline = PolylineBuilderEx.CreatePolyline(list, SpatialReferences.WGS84);

// use AttributeFlags.None since we only have 2D points in the list
PolylineBuilderEx pb = new PolylineBuilderEx(list, AttributeFlags.None);
pb.SpatialReference = SpatialReferences.WGS84;
Polyline polyline2 = pb.ToGeometry();

//     use AttributeFlags.NoAttributes because we only have 2d points in the list
Polyline polyline4 = PolylineBuilderEx.CreatePolyline(list, AttributeFlags.None);
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

ArcGIS Pro version: 2.8 or higher.
See Also