ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Geometry Namespace / Coordinate2D Structure / ToMapPoint Method
(Optional) The SpatialReference. Default value is null.
Example

In This Topic
    ToMapPoint Method (Coordinate2D)
    In This Topic
    Convert the Coordinate2D into a MapPoint.
    Syntax
    Public Function ToMapPoint( _
       Optional ByVal spatialReference As SpatialReference _
    ) As MapPoint

    Parameters

    spatialReference
    (Optional) The SpatialReference. Default value is null.

    Return Value

    Example
    Construct a Cubic Bezier - from Coordinates
    {
      // Use a builderEx convenience method or a builderEx constructor.
    
      MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0);
      MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 2.0, 3.0);
    
      Coordinate2D ctrl1Pt = new Coordinate2D(1.0, 2.0);
      Coordinate2D ctrl2Pt = new Coordinate2D(2.0, 1.0);
    
      // BuilderEx convenience methods don't need to run on the MCT
      CubicBezierSegment bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(startPt, ctrl1Pt, ctrl2Pt, endPt, SpatialReferences.WGS84);
    
      // without a SR
      bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(startPt, ctrl1Pt, ctrl2Pt, endPt);
    
    
      // builderEx constructors don't need to run on the MCT
      CubicBezierBuilderEx cbbEx = new CubicBezierBuilderEx(startPt, ctrl1Pt, ctrl2Pt, endPt);
      bezier = cbbEx.ToSegment() as CubicBezierSegment;
    
      // another alternative
      cbbEx = new CubicBezierBuilderEx(startPt, ctrl1Pt.ToMapPoint(), ctrl2Pt.ToMapPoint(), endPt);
      bezier = cbbEx.ToSegment() as CubicBezierSegment;
    }
    Calculate a geometry offset from the source
    {
        List<MapPoint> linePts =
        [
          MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84),
      MapPointBuilderEx.CreateMapPoint(10.0, 1.0, SpatialReferences.WGS84),
    ];
    
        polyline = PolylineBuilderEx.CreatePolyline(linePts);
    
        Geometry g = GeometryEngine.Instance.Offset(polyline, 10, OffsetType.Square, 0);
        Polyline gResult = g as Polyline;
        // gResult.PointCount = 2
        // gResult.Points[0] = (1, -9)
        // gResult.Points[1] = (10, -9)
    
        g = GeometryEngine.Instance.Offset(polyline, -10, OffsetType.Round, 0.5);
        gResult = g as Polyline;
        // gResult.PointCount = 2
        // gResult.Points[0] = (1, -11
        // gResult.Points[1] = (10, 11)
    
        //
        // elliptic arc curve
        //
        Coordinate2D fromPt = new(2, 1);
        Coordinate2D toPt = new(1, 2);
        Coordinate2D interiorPt = new(1 + Math.Sqrt(2) / 2, 1 + Math.Sqrt(2) / 2);
    
        EllipticArcSegment circularArc = EllipticArcBuilderEx.CreateCircularArc(fromPt.ToMapPoint(), toPt.ToMapPoint(), interiorPt);
    
        polyline = PolylineBuilderEx.CreatePolyline(circularArc);
        g = GeometryEngine.Instance.Offset(polyline, -0.25, OffsetType.Miter, 0.5);
        gResult = g as Polyline;
    
        g = GeometryEngine.Instance.Offset(polyline, 0.25, OffsetType.Bevel, 0.5);
        gResult = g as Polyline;
    
        //
        //  offset for a polygon
        //
        List<MapPoint> list =
        [
          MapPointBuilderEx.CreateMapPoint(10.0, 10.0, SpatialReferences.WGS84),
        MapPointBuilderEx.CreateMapPoint(10.0, 20.0, SpatialReferences.WGS84),
        MapPointBuilderEx.CreateMapPoint(20.0, 20.0, SpatialReferences.WGS84),
        MapPointBuilderEx.CreateMapPoint(20.0, 10.0, SpatialReferences.WGS84),
      ];
    
        polygon = PolygonBuilderEx.CreatePolygon(list);
    
        g = GeometryEngine.Instance.Offset(polygon, 2, OffsetType.Square, 0);
        Polygon gPolygon = g as Polygon;
    
        g = GeometryEngine.Instance.Offset(polygon, -2, OffsetType.Round, 0.3);
        gPolygon = g as Polygon;
    
        g = GeometryEngine.Instance.Offset(polygon, -0.5, OffsetType.Miter, 0.6);
        gPolygon = g as Polygon;
      }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also