ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / Coordinate2D Structure / Coordinate2D Constructor / Coordinate2D Constructor(Double,Double)
X value. This is longitude when working with geographic coordinates.
Y value. This is latitude when working with geographic coordinates.
Example

In This Topic
    Coordinate2D Constructor(Double,Double)
    In This Topic
    Represents a Coordinate2D with an X and Y value.
    Syntax
    public Coordinate2D( 
       double x,
       double y
    )
    Public Function New( _
       ByVal x As Double, _
       ByVal y As Double _
    )

    Parameters

    x
    X value. This is longitude when working with geographic coordinates.
    y
    Y value. This is latitude when working with geographic coordinates.
    Example
    2D Vector Operations
    Coordinate2D v = new Coordinate2D(0, 1);
    // v.Magnitude = 1
    
    Coordinate2D other = new Coordinate2D(-1, 0);
    double dotProduct = v.DotProduct(other);
    // dotProduct = 0
    
    Coordinate2D w = v + other;
    // w = (-1, 1)
    
    w += other;
    // w = (-2, 1)
    
    w -= other;
    // w = (-1, 1)
    
    w = v;
    w.Rotate(Math.PI, other);
    // w = (-2, -1)
    
    w = other;
    
    w.Scale(-4);
    // w = (4, 0)
    // w.Magnitude = 4
    
    w.Move(-1, 4);
    // w = (3, 4)
    // w.Magnitude = 5
    
    w.Move(-6, -1);
    Tuple<double, double> components = w.QueryComponents();
    // components = (-3, 3)
    // w.Magnitude = 3 * Math.Sqrt(2)
    
    Coordinate2D unitVector = w.GetUnitVector();
    // w = (-Math.Sqrt(2) / 2, Math.Sqrt(2) / 2)
    // w.Magnitude = 1
    
    
    w.SetComponents(3, 4);
    
    Build a donut polygon
    List<Coordinate2D> outerCoordinates = new List<Coordinate2D>();
    outerCoordinates.Add(new Coordinate2D(10.0, 10.0));
    outerCoordinates.Add(new Coordinate2D(10.0, 20.0));
    outerCoordinates.Add(new Coordinate2D(20.0, 20.0));
    outerCoordinates.Add(new Coordinate2D(20.0, 10.0));
    
    // define the inner polygon as anti-clockwise
    List<Coordinate2D> innerCoordinates = new List<Coordinate2D>();
    innerCoordinates.Add(new Coordinate2D(13.0, 13.0));
    innerCoordinates.Add(new Coordinate2D(17.0, 13.0));
    innerCoordinates.Add(new Coordinate2D(17.0, 17.0));
    innerCoordinates.Add(new Coordinate2D(13.0, 17.0));
    
    PolygonBuilderEx pbEx = new PolygonBuilderEx(outerCoordinates);
    Polygon donutEx = pbEx.ToGeometry() as Polygon;
    double areaEx = donutEx.Area;       // area = 100
    
    pbEx.AddPart(innerCoordinates);
    donutEx = pbEx.ToGeometry() as Polygon;
    
    areaEx = donutEx.Area;    // area = 84.0
    
    areaEx = GeometryEngine.Instance.Area(donutEx);    // area = 84.0
    
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also