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

In This Topic
    CreateMapPoint(Double,Double,Double,SpatialReference) Method
    In This Topic
    Convenience method to create a MapPoint instance with the given X, Y, and Z coordinates. The HasZ property on this instance is set to true.
    Syntax
    public static MapPoint CreateMapPoint( 
       double x,
       double y,
       double z,
       SpatialReference spatialReference
    )
    Public Overloads Shared Function CreateMapPoint( _
       ByVal x As Double, _
       ByVal y As Double, _
       ByVal z As Double, _
       Optional ByVal spatialReference As SpatialReference _
    ) As MapPoint

    Parameters

    x
    X coordinate.
    y
    Y coordinate.
    z
    Z coordinate. HasZ is set to true.
    spatialReference
    (Optional) The SpatialReference. The default value is null.

    Return Value

    Example
    Builder Properties
    {
      // list of points
      List<MapPoint> pointsForBuilder = new List<MapPoint>
    {
      MapPointBuilderEx.CreateMapPoint(0, 0, 2, 3, 1),
      MapPointBuilderEx.CreateMapPoint(1, 1, 5, 6),
      MapPointBuilderEx.CreateMapPoint(2, 1, 6),
      MapPointBuilderEx.CreateMapPoint(0, 0)
    };
    
      // will have attributes because it is created with convenience method
      Polyline polylineWithAttrs = PolylineBuilderEx.CreatePolyline(pointsForBuilder);
      bool hasZ = polylineWithAttrs.HasZ;          // hasZ = true
      bool hasM = polylineWithAttrs.HasM;          // hasM = true
      bool hasID = polylineWithAttrs.HasID;        // hasID = true
    
      // will not have attributes because it is specified as a parameter
      Polyline polylineWithoutAttrs =
        PolylineBuilderEx.CreatePolyline(pointsForBuilder, AttributeFlags.None);
      hasZ = polylineWithoutAttrs.HasZ;          // hasZ = false
      hasM = polylineWithoutAttrs.HasM;          // hasM = false
      hasID = polylineWithoutAttrs.HasID;        // hasID = false
    
      // will have attributes because it is created with convenience method
      Polygon polygonWithAttrs = PolygonBuilderEx.CreatePolygon(pointsForBuilder);
      hasZ = polygonWithAttrs.HasZ;               // hasZ = true
      hasM = polygonWithAttrs.HasM;               // hasM = true
      hasID = polygonWithAttrs.HasID;             // hasID = true
    
      // will not have attributes because it is specified as a parameter
      Polygon polygonWithoutAttrs =
            PolygonBuilderEx.CreatePolygon(pointsForBuilder, AttributeFlags.None);
      hasZ = polygonWithoutAttrs.HasZ;               // hasZ = false
      hasM = polygonWithoutAttrs.HasM;               // hasM = false
      hasID = polygonWithoutAttrs.HasID;             // hasID = false
    
      // will not have attributes because it is specified as a parameter
      PolylineBuilderEx polylineB =
                 new PolylineBuilderEx(pointsForBuilder, AttributeFlags.None);
      hasZ = polylineB.HasZ;                      // hasZ = false
      hasM = polylineB.HasM;                      // hasM = false
      hasID = polylineB.HasID;                    // hasID = false
    
      // will have attributes because it is passed an attributed polyline
      polylineB = new PolylineBuilderEx(polylineWithAttrs);
      hasZ = polylineB.HasZ;                      // hasZ = true
      hasM = polylineB.HasM;                      // hasM = true
      hasID = polylineB.HasID;                    // hasID = true
    
      // will not have attributes because it is passed a non-attributed polyline
      polylineB = new PolylineBuilderEx(polylineWithoutAttrs);
      hasZ = polylineB.HasZ;                      // hasZ = false
      hasM = polylineB.HasM;                      // hasM = false
      hasID = polylineB.HasID;                    // hasID = false
    
      // will not have attributes because it is specified as a parameter
      PolygonBuilderEx polygonB = new PolygonBuilderEx(pointsForBuilder, AttributeFlags.None);
      hasZ = polygonB.HasZ;                       // hasZ = false
      hasM = polygonB.HasM;                       // hasM = false
      hasID = polygonB.HasID;                     // hasID = false
    
      // will have attributes because it is passed an attributed polygon
      polygonB = new PolygonBuilderEx(polygonWithAttrs);
      hasZ = polygonB.HasZ;                       // hasZ = true
      hasM = polygonB.HasM;                       // hasM = true
      hasID = polygonB.HasID;                     // hasID = true
    
      // will not have attributes because it is passed a non-attributed polygon
      polygonB = new PolygonBuilderEx(polygonWithoutAttrs);
      hasZ = polygonB.HasZ;                       // hasZ = true
      hasM = polygonB.HasM;                       // hasM = true
      hasID = polygonB.HasID;                     // hasID = true
    }
    MapPoint IsEqual
    {
      MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(1, 2, 3, 4, 5);
      int ID = pt1.ID;           // ID = 5
      bool hasID = pt1.HasID;     // hasID = true
    
      MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(1, 2, 3, 4, 0);
      ID = pt2.ID;        // ID = 0
      hasID = pt2.HasID;  // hasID = true
    
      MapPoint pt3 = MapPointBuilderEx.CreateMapPoint(1, 2, 3, 4);
      ID = pt3.ID;          // ID = 0
      hasID = pt3.HasID;    // hasID = false
    
      MapPoint pt4 = MapPointBuilderEx.CreateMapPoint(1, 2, 3, 44);
      ID = pt4.ID;          // ID = 0
      hasID = pt4.HasID;    // hasID = false
      bool hasM = pt4.HasM; // hasM = true
    
      MapPoint pt5 = MapPointBuilderEx.CreateMapPoint(1, 2, 3);
      ID = pt5.ID;          // ID = 0
      hasID = pt5.HasID;    // hasID = false
      hasM = pt5.HasM;      // hasM = false
    
      bool isEqual = pt1.IsEqual(pt2);   // isEqual = false, different IDs
      isEqual = pt2.IsEqual(pt3);        // isEqual = false, HasId is different
      isEqual = pt4.IsEqual(pt3);        // isEqual = false, different Ms
      isEqual = pt1.IsEqual(pt5);        // isEqual = false, pt has M, id but pt5 does not.
    }
    Construct a Multipoint - using MultipointBuilderEx
    {
      Coordinate2D[] coordinate2Ds = new Coordinate2D[] { new Coordinate2D(1, 2), new Coordinate2D(-1, -2) };
      SpatialReference sr = SpatialReferences.WGS84;
    
      MultipointBuilderEx builder = new MultipointBuilderEx(coordinate2Ds, sr);
    
      // builder.PointCount = 2
    
      builder.HasZ = true;
      // builder.Zs.Count = 2
      // builder.Zs[0] = 0
      // builder.Zs[1] = 0
    
      builder.HasM = true;
      // builder.Ms.Count = 2
      // builder.Ms[0] = NaN
      // builder.Ms[1] = NaN
    
      builder.HasID = true;
      // builder.IDs.Count = 2
      // builder.IDs[0] = 0
      // builder.IDs[1] = 0
    
      // set it empty
      builder.SetEmpty();
      // builder.Coords.Count = 0
      // builder.Zs.Count = 0
      // builder.Ms.Count = 0
      // builder.IDs.Count = 0
    
    
      // reset coordinates
      List<Coordinate2D> inCoords = new List<Coordinate2D>() { new Coordinate2D(1, 2), new Coordinate2D(3, 4), new Coordinate2D(5, 6) };
      builder.Coordinate2Ds = inCoords;
      // builder.Coords.Count = 3
      // builder.HasZ = true
      // builder.HasM = true
      // builder.HasID = true
    
      double[] zs = new double[] { 1, 2, 1, 2, 1, 2 };
      builder.Zs = zs;
      // builder.Zs.Count = 6
    
      double[] ms = new double[] { 0, 1 };
      builder.Ms = ms;
      // builder.Ms.Count = 2
    
      // coordinates are now   (x, y, z, m, id)
      //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, NaN, 0)
    
      MapPoint mapPointFromBuilder = builder.GetPoint(2);
      // mapPoint.HasZ = true
      // mapPoint.HasM = true
      // mapPoint.HasID = true
      // mapPoint.Z  = 1
      // mapPoint.M = NaN
      // mapPoint.ID = 0
    
      // add an M to the list
      builder.Ms.Add(2);
      // builder.Ms.count = 3
    
      // coordinates are now   (x, y, z, m, id)
      //  (1, 2, 1, 0, 0), (3, 4, 2, 1, 0) (5, 6, 1, 2, 0)
    
      // now get the 2nd point again; it will now have an M value
      mapPointFromBuilder = builder.GetPoint(2);
      // mapPoint.M = 2
    
    
      int[] ids = new int[] { -1, -2, -3 };
      // assign ID values
      builder.IDs = ids;
    
      // coordinates are now   (x, y, z, m, id)
      //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (5, 6, 1, 2, -3)
    
    
      // create a new point
      MapPoint pointFromBuilder = MapPointBuilderEx.CreateMapPoint(-300, 400, 4);
      builder.SetPoint(2, pointFromBuilder);
    
      // coordinates are now   (x, y, z, m, id)
      //  (1, 2, 1, 0, -1), (3, 4, 2, 1, -2) (-300, 400, 4, NaN, 0)
    
    
      builder.RemovePoints(1, 3);
      // builder.PointCount = 1
    }
    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;
    }
    Construct 3D special Multipatch shapes
    {
      var sr = MapView.Active.Map.SpatialReference;
    
      var extent = MapView.Active.Extent;
      var center = extent.Center;
      var centerZ = MapPointBuilderEx.CreateMapPoint(center.X, center.Y, 500, sr);
    
      // cube
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cube, centerZ, 200, sr);
      // tetrahedron
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Tetrahedron, centerZ, 200, sr);
      // diamond
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Diamond, centerZ, 200, sr);
      // hexagon
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Hexagon, centerZ, 200, sr);
    
      // sphere frame
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.SphereFrame, centerZ, 200, 0.8, sr);
      // sphere
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Sphere, centerZ, 200, 0.8, sr);
      // cylinder
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cylinder, centerZ, 200, 0.8, sr);
      // cone
      multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cone, centerZ, 200, 0.8, sr);
    
      // use the builder to add materials or textures
      // create the multipatchBuilderEx object
      var builder = new ArcGIS.Core.Geometry.MultipatchBuilderEx(multipatch);
      //   - create a cone with a material
      builder = new MultipatchBuilderEx(MultipatchConstructType.Cone, centerZ, 200, 0.8, sr);
    
      BasicMaterial faceMaterial = new BasicMaterial();
      faceMaterial.Color = System.Windows.Media.Color.FromRgb(255, 0, 0);
      faceMaterial.Shininess = 150;
      faceMaterial.TransparencyPercent = 50;
      faceMaterial.EdgeWidth = 20;
    
      foreach (var patch in builder.Patches)
      {
        patch.Material = faceMaterial;
      }
    
      multipatch = builder.ToGeometry() as Multipatch;
    }
    Import and Export Geometries to XML
    {
      MapPoint minPoint = MapPointBuilderEx.CreateMapPoint(1, 1, 1, 1, 3);
      MapPoint maxPoint = MapPointBuilderEx.CreateMapPoint(5, 5, 5);
    
      //
      //  MapPoint
      //
      string xml = minPoint.ToXml();
      MapPoint minPointImport = MapPointBuilderEx.FromXml(xml);
      // minPointImport = minPoint
    
      //
      // Envelope
      //
      Envelope envelopeWithID = EnvelopeBuilderEx.CreateEnvelope(minPoint, maxPoint);
    
      // Envelopes don't have IDs
      // envelopeWithID.HasID = false
      // envelopeWithID.HasM = true
      // envelopeWithID.HasZ = true
    
      xml = envelopeWithID.ToXml();
      Envelope envelopeImport = EnvelopeBuilderEx.FromXml(xml);
    
      //
      // Multipoint
      //
      List<MapPoint> list = new List<MapPoint>();
      list.Add(minPoint);
      list.Add(maxPoint);
    
      Multipoint multiPoint = MultipointBuilderEx.CreateMultipoint(list);
    
      xml = multiPoint.ToXml();
      Multipoint multipointImport = MultipointBuilderEx.FromXml(xml);
      // multipointImport.PointCount == 2
      // multipointImport.HasID = true
      // multipointImport.HasM = true
      // multipointImport.HasZ= true
    }
    Determine if two Geometries are disjoint
    {
        //
        // pt on pt
        //
    
        MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
        MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(2.0, 2.5);
    
        bool disjoint = GeometryEngine.Instance.Disjoint(pt, pt2);       // result is true
    
        MultipointBuilderEx mpb = new();
        mpb.AddPoint(pt);
        mpb.AddPoint(pt2);
        Multipoint multiPoint = mpb.ToGeometry();
    
        disjoint = GeometryEngine.Instance.Disjoint(multiPoint, pt);     // result is false
    
        //
        // pt and line
        //
    
        List<MapPoint> list =
        [
          MapPointBuilderEx.CreateMapPoint(1.0, 1.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(5.0, 1.0),
    ];
    
        Polyline line1 = PolylineBuilderEx.CreatePolyline(list);
        disjoint = GeometryEngine.Instance.Disjoint(line1, pt2);       // result is true
    
        disjoint = GeometryEngine.Instance.Disjoint(pt2, line1);       // result is true
    
        // end pt of line
        disjoint = GeometryEngine.Instance.Disjoint(line1, pt);        // result is false
    
        //
        // pt and polygon
        //
        List<MapPoint> polyPts =
        [
          MapPointBuilderEx.CreateMapPoint(3.0, 2.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 6.0),
      MapPointBuilderEx.CreateMapPoint(6.0, 6.0),
      MapPointBuilderEx.CreateMapPoint(6.0, 2.0),
    ];
    
        Polygon poly1 = PolygonBuilderEx.CreatePolygon(polyPts);
        disjoint = GeometryEngine.Instance.Disjoint(poly1, pt);          // result is true
        disjoint = GeometryEngine.Instance.Disjoint(pt, poly1);          // result is true
    
        //
        // line and line
        //
    
        List<MapPoint> list2 =
        [
          MapPointBuilderEx.CreateMapPoint(1.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 1.0),
      MapPointBuilderEx.CreateMapPoint(5.0, 3.0),
    ];
    
        Polyline line2 = PolylineBuilderEx.CreatePolyline(list2);
        disjoint = GeometryEngine.Instance.Disjoint(line1, line2);         // result is false
    
        //
        // line and polygon
        //
        disjoint = GeometryEngine.Instance.Disjoint(poly1, line1);         // result is false
        disjoint = GeometryEngine.Instance.Disjoint(line1, poly1);         // result is false
    
        //
        // polygon and polygon
        //
        Envelope env = EnvelopeBuilderEx.CreateEnvelope(MapPointBuilderEx.CreateMapPoint(1.0, 1.0), MapPointBuilderEx.CreateMapPoint(4, 4));
        Polygon poly2 = PolygonBuilderEx.CreatePolygon(env);
    
        disjoint = GeometryEngine.Instance.Disjoint(poly1, poly2);         // result is false
    
    
        // disjoint3D
    
        SpatialReference sr = SpatialReferences.WGS84;
    
        MapPoint pt3D_1 = MapPointBuilderEx.CreateMapPoint(1, 1, 1, sr);
        MapPoint pt3D_2 = MapPointBuilderEx.CreateMapPoint(2, 2, 2, sr);
        MapPoint pt3D_3 = MapPointBuilderEx.CreateMapPoint(1, 1, 2, sr);
    
        MultipointBuilderEx mpbEx = new();
        mpbEx.AddPoint(pt3D_1);
        mpbEx.AddPoint(pt3D_2);
        mpbEx.HasZ = true;
    
        multiPoint = mpbEx.ToGeometry();
        disjoint = GeometryEngine.Instance.Disjoint3D(multiPoint, pt3D_2);     // disjoint = false
        disjoint = GeometryEngine.Instance.Disjoint3D(multiPoint, pt3D_3);     // disjoint = true
      }
    Determine 3D distance between two Geometries
    {
      // between points
      MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(1, 1, 1);
      MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(2, 2, 2);
      MapPoint pt3 = MapPointBuilderEx.CreateMapPoint(10, 2, 1);
    
      // pt1 to pt2
      double d = GeometryEngine.Instance.Distance3D(pt1, pt2);        // d = Math.Sqrt(3)
    
      // pt1 to pt3
      d = GeometryEngine.Instance.Distance3D(pt1, pt3);        // d = Math.Sqrt(82)
    
      // pt2 to pt3
      d = GeometryEngine.Instance.Distance3D(pt2, pt3);        // d = Math.Sqrt(65)
    
      // intersecting lines
    
      List<MapPoint> list =
      [
        MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 1.0),
        MapPointBuilderEx.CreateMapPoint(3.0, 3.0, 1.0),
        MapPointBuilderEx.CreateMapPoint(5.0, 1.0, 1.0),
      ];
    
      Polyline line1 = PolylineBuilderEx.CreatePolyline(list);
    
      List<MapPoint> list2 =
      [
        MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 1.0),
        MapPointBuilderEx.CreateMapPoint(3.0, 1.0, 1.0),
        MapPointBuilderEx.CreateMapPoint(5.0, 3.0, 1.0),
      ];
    
      Polyline line2 = PolylineBuilderEx.CreatePolyline(list2);
    
      bool intersects = GeometryEngine.Instance.Intersects(line1, line2);    // intersects = true
      d = GeometryEngine.Instance.Distance3D(line1, line2);                  // d = 0   (distance is 0 when geomtries intersect)
    }
    Expand envelopes
    {
      Envelope env = EnvelopeBuilderEx.CreateEnvelope(100.0, 100.0, 500.0, 500.0);
      // env.HasZ = false
    
      Envelope result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, true);
      // result.Center = 300, 300
      // result.XMin = 200
      // result.YMin = 200
      // result.XMax = 400
      // result.YMax = 400
    
      result = GeometryEngine.Instance.Expand(env, 100, 200, false);
      // result.Center = 300, 300
      // result.XMin = 0
      // result.YMin = -100
      // result.XMax = 600
      // result.YMax = 700
    
      try
      {
        // expand in 3 dimensions
        result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);
      }
      catch (InvalidOperationException)
      {
        // the geometry is not Z-Aware
      }
    
      // expand a 3d envelope
      MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(100, 100, 100);
      MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(200, 200, 200);
    
      env = EnvelopeBuilderEx.CreateEnvelope(pt1, pt2);
      // env.HasZ = true
    
      result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);
    
      // result.Center = 150, 150, 150
      // result.XMin = 125
      // result.YMin = 125
      // result.ZMin = 125
      // result.XMax = 175
      // result.YMax = 175
      // result.ZMax = 175
    }
    Determine Length, Length3D of line
    {
      MapPoint c1 = MapPointBuilderEx.CreateMapPoint(1, 2, 3);
      MapPoint c2 = MapPointBuilderEx.CreateMapPoint(4, 2, 4);
    
      // line segment
      LineSegment line = LineBuilderEx.CreateLineSegment(c1, c2);
      double len = line.Length;     // = 3
      double len3D = line.Length3D;   // = Math.Sqrt(10)
    
      // polyline
      Polyline p = PolylineBuilderEx.CreatePolyline(line);
      double p_len = p.Length;        // = len = 3
      double p_len3D = p.Length3D;    // = len3D = Math.Sqrt(10)
    
      double ge_len = GeometryEngine.Instance.Length(p);      // = p_len = len = 3
      double ge_len3d = GeometryEngine.Instance.Length3D(p);    // = p_len3D = len3D = Math.Sqrt(10)
    }
    Move a z-aware MapPoint
    {
      MapPoint zPt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 2.0);
      MapPoint zPtResult = GeometryEngine.Instance.Move(zPt, 4, 0.25, 0.5) as MapPoint;
      // zPtResult is (5.0, 3.25, 2.5);
    }
    Move a Polyline
    {
        List<MapPoint> pts =
        [
          MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 3.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3, 2, 3.0),
      MapPointBuilderEx.CreateMapPoint(4.0, 2.0, 3.0),
    ];
    
        polyline = PolylineBuilderEx.CreatePolyline(pts);
    
        Geometry geometry = GeometryEngine.Instance.Move(polyline, 3, 2);
        Polyline polylineResult = geometry as Polyline;
        // polylineResult.Points[0] = 4.0, 3.0, 3.0
        // polylineResult.Points[1] = 6.0, 5.0, 3.0
        // polylineResult.Points[2] = 6.0, 4.0, 3.0
        // polylineResult.Points[3] = 7.0, 4.0, 3.0
      }
    MovePointAlongLine
    {
      LineSegment line = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(0, 3), MapPointBuilderEx.CreateMapPoint(5.0, 3.0));
      polyline = PolylineBuilderEx.CreatePolyline(line);
      bool simple = GeometryEngine.Instance.IsSimpleAsFeature(polyline);
    
      // ratio = false
      MapPoint pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 1.0, false, 0.0, SegmentExtensionType.NoExtension);
      // pt = 1.0, 3.0
    
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 1.0, false, -1.0, SegmentExtensionType.NoExtension);
      // pt = 1.0, 4.0
    
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 1.0, false, 2.0, SegmentExtensionType.NoExtension);
      // pt = 1.0, 1.0
    
      // ratio = true
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 0.5, true, 0, SegmentExtensionType.NoExtension);
      // pt = 2.5, 3.0
    
      // move past the line
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 7, false, 0, SegmentExtensionType.NoExtension);
      // pt = 5.0, 3.0
    
      // move past the line with extension at "to" point
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 7, false, 0, SegmentExtensionType.ExtendEmbeddedAtTo);
      // pt = 7.0, 3.0
    
      // negative distance with extension at "from" point
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, -2, false, 0, SegmentExtensionType.ExtendEmbeddedAtFrom);
      // pt = -2.0, 3.0
    
      // ratio = true
      pt = GeometryEngine.Instance.MovePointAlongLine(polyline, 0.5, true, 0, SegmentExtensionType.NoExtension);
      // pt = 2.5, 3.0
    
      // line with Z
      List<Coordinate3D> coords3D = [new Coordinate3D(0, 0, 0), new Coordinate3D(1113195, 1118890, 5000)];
      Polyline polylineZ = PolylineBuilderEx.CreatePolyline(coords3D, SpatialReferences.WebMercator);
      // polylineZ.HasZ = true
    
      // ratio = true, no offset
      pt = GeometryEngine.Instance.MovePointAlongLine(polylineZ, 0.5, true, 0, SegmentExtensionType.NoExtension);
      // pt.X = 556597.5
      // pt.Y = 559445
      // pt.Z = 2500
    
      // ratio = true, past the line with "to" extension, no offset
      pt = GeometryEngine.Instance.MovePointAlongLine(polylineZ, 1.5, true, 0, SegmentExtensionType.ExtendEmbeddedAtTo);
      // pt.X = 1669792.5
      // pt.Y = 1678335
      // pt.Z = 7500
    
      // ratio = true, negative distance past the line with no extension, no offset
      pt = GeometryEngine.Instance.MovePointAlongLine(polylineZ, -1.5, true, 0, SegmentExtensionType.NoExtension);
      // pt.X = 0
      // pt.Y = 0
      // pt.Z = -7500
    
      // polyline with Z but 2d distance = 0
      MapPoint pt3 = MapPointBuilderEx.CreateMapPoint(5, 5, 0);
      MapPoint pt4 = MapPointBuilderEx.CreateMapPoint(5, 5, 10);
      List<MapPoint> pts = [pt3, pt4];
    
      polyline = PolylineBuilderEx.CreatePolyline(pts);
      // polyline.HasZ = true
      // polyline.Length3D = 10
      // polyline.Length = 0
    
      MapPoint result = GeometryEngine.Instance.MovePointAlongLine(polyline, 2, false, 0, SegmentExtensionType.NoExtension);
      // result = 5, 5, 2
    
      // polyline with length2d = 0 and length3d = 0
      MapPoint pt5 = MapPointBuilderEx.CreateMapPoint(5, 5, 10);
      MapPoint pt6 = MapPointBuilderEx.CreateMapPoint(5, 5, 10);
      pts.Clear();
      pts.Add(pt5);
      pts.Add(pt6);
    
      polyline = PolylineBuilderEx.CreatePolyline(pts);
      // polyline.HasZ = true
      // polyline.Length3D = 0
      // polyline.Length = 0
    
      result = GeometryEngine.Instance.MovePointAlongLine(polyline, 3, true, 0, SegmentExtensionType.NoExtension);
      // result = 5, 5, 10
    
      result = GeometryEngine.Instance.MovePointAlongLine(polyline, 3, true, 0, SegmentExtensionType.ExtendEmbeddedAtFrom);
      // result = 5, 5, 10
    
      // polyline with Z and M
      List<MapPoint> inputPoints =
      [
          MapPointBuilderEx.CreateMapPoint(1, 2, 3, 4),
        MapPointBuilderEx.CreateMapPoint(1, 2, 33, 44),
    ];
    
      Polyline polylineZM = PolylineBuilderEx.CreatePolyline(inputPoints, SpatialReferences.WGS84);
      // polylineZM.HasZ = true
      // polylineZM.HasM = true
    
      // ratio = true, no offset
      MapPoint pointAlong = GeometryEngine.Instance.MovePointAlongLine(polylineZM, 0.5, true, 0, SegmentExtensionType.NoExtension);
      // pointAlong = 1, 2, 18, 24
    
      // ratio = true with offset
      pointAlong = GeometryEngine.Instance.MovePointAlongLine(polylineZM, 0.2, true, 2.23606797749979, SegmentExtensionType.NoExtension);
      // pointAlong = 1, 2, 9, 12
    }
    Determine Nearest Point in 3D
    {
      MapPoint pt1 = MapPointBuilderEx.CreateMapPoint(1, 1, 1);
      MapPoint pt2 = MapPointBuilderEx.CreateMapPoint(2, 2, 2);
      MapPoint pt3 = MapPointBuilderEx.CreateMapPoint(10, 2, 1);
    
      //
      // test pt1 to pt2
      //
      ProximityResult result = GeometryEngine.Instance.NearestPoint3D(pt1, pt2);
      // result.Point = 1,1,1
      // result.Distance = Math.Sqrt(3)
      // result.SegmentIndex = null
      // result.PartIndex = 0
      // result.PointIndex = 0
      // result.RightSide = false
    
      //
      // multipoint built from pt1, pt2.   should be closer to pt2
      //
      Multipoint multipoint = MultipointBuilderEx.CreateMultipoint([pt1, pt2]);
      result = GeometryEngine.Instance.NearestPoint3D(multipoint, pt3);
      // result.Point = 2, 2, 2
      // result.Distance = Math.Sqrt(65)
      // result.SegmentIndex = null
      // result.PartIndex = 1
      // result.PointIndex = 1
      // result.RightSide = false
    }
    Scale a geometry
    {
      List<MapPoint> pts =
      [
        MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3, 3, 3.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 1.0, 3.0),
    ];
    
      MapPoint midPt = MapPointBuilderEx.CreateMapPoint(1.5, 1.5);
    
      // polyline
      polyline = PolylineBuilderEx.CreatePolyline(pts);
      // polyline.Length = 6
      // polyline.Length3D = 0
      Geometry g = GeometryEngine.Instance.Scale(polyline, midPt, 0.5, 0.5);
      Polyline resultPolyline = g as Polyline;
      // resultPolyline.length  = 3
      // resultPolyline.Points[0] = 1.25, 1.25, 3
      // resultPolyline.Points[1] = 1.25, 2.25, 3
      // resultPolyline.Points[2] = 2.25, 2.25, 3
      // resultPolyline.Points[3] = 2.25, 1.25, 3
    
      // 3D point - scale in 3d
      MapPoint midPtZ = MapPointBuilderEx.CreateMapPoint(1.5, 1.5, 1);
      g = GeometryEngine.Instance.Scale(polyline, midPtZ, 0.5, 0.5, 0.25);
      resultPolyline = g as Polyline;
      // resultPolyline.Points[0] = 1.25, 1.25, 1.5
      // resultPolyline.Points[1] = 1.25, 2.25, 1.5
      // resultPolyline.Points[2] = 2.25, 2.25, 1.5
      // resultPolyline.Points[3] = 2.25, 1.25, 1.5
    }
    Calculate area of geometry on surface of Earth's ellipsoid - ShapePreservingArea
    {
      // pt
      MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0, SpatialReferences.WebMercator);
      double area = GeometryEngine.Instance.ShapePreservingArea(pt);         // area = 0
    
      List<MapPoint> pts =
      [
        MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3, 3, 3.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 1.0, 3.0),
    ];
    
      // multipoint
      Multipoint mPt = MultipointBuilderEx.CreateMultipoint(pts);
      area = GeometryEngine.Instance.ShapePreservingArea(mPt);               // area = 0
    
      // polyline
      polyline = PolylineBuilderEx.CreatePolyline(pts);
      area = GeometryEngine.Instance.ShapePreservingArea(polyline);          // area = 0
    
      // polygon
      polygon = PolygonBuilderEx.CreatePolygon(pts, SpatialReferences.WGS84);
      area = GeometryEngine.Instance.ShapePreservingArea(polygon);
    
      polygon = PolygonBuilderEx.CreatePolygon(pts, SpatialReferences.WebMercator);
      area = GeometryEngine.Instance.ShapePreservingArea(polygon);
    
      polygon = PolygonBuilderEx.CreatePolygon(
      [
        MapPointBuilderEx.CreateMapPoint( -170, 45),
      MapPointBuilderEx.CreateMapPoint( 170, 45),
      MapPointBuilderEx.CreateMapPoint( 170, -45),
      MapPointBuilderEx.CreateMapPoint( -170, -54)
      ], SpatialReferences.WGS84);
    
      var area_meters = GeometryEngine.Instance.ShapePreservingArea(polygon);// , AreaUnits.SquareMeters);
      var area_miles = GeometryEngine.Instance.ShapePreservingArea(polygon, AreaUnit.SquareMiles);
    
      // area_meters - 352556425383104.37
      // area_miles - 136122796.848425
    }
    Calculate length of geometry on surface of Earth's ellipsoid - ShapePreservingLength
    {
      // pt
      MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0, SpatialReferences.WebMercator);
      double len = GeometryEngine.Instance.ShapePreservingLength(pt);          // len = 0
    
      List<MapPoint> pts =
      [
        MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(1.0, 3.0, 3.0),
      MapPointBuilderEx.CreateMapPoint(3, 3, 3.0),
      MapPointBuilderEx.CreateMapPoint(3.0, 1.0, 3.0),
    ];
    
      // multipoint
      Multipoint mPt = MultipointBuilderEx.CreateMultipoint(pts);
      len = GeometryEngine.Instance.ShapePreservingLength(mPt);                // len = 0
    
      // polyline
      polyline = PolylineBuilderEx.CreatePolyline(pts, SpatialReferences.WGS84);
      len = GeometryEngine.Instance.ShapePreservingLength(polyline);
    
      // polygon
      polygon = PolygonBuilderEx.CreatePolygon(pts, SpatialReferences.WGS84);
      len = GeometryEngine.Instance.ShapePreservingLength(polygon);
    
      polyline = PolylineBuilderEx.CreatePolyline(
      [
        MapPointBuilderEx.CreateMapPoint( -170, 0),
      MapPointBuilderEx.CreateMapPoint( 170, 0)
      ], SpatialReferences.WGS84);
    
    
      var length_meters = GeometryEngine.Instance.ShapePreservingLength(polyline); // , LinearUnits.Meters);
      var length_miles = GeometryEngine.Instance.ShapePreservingLength(polyline, LinearUnit.Miles);
    
      // length_meters - 37848626.869713023
      // length_miles - 23518.046402579574
    }
    Split multipart at point
    {
      // define a polyline
      MapPoint startPointZ = MapPointBuilderEx.CreateMapPoint(1, 1, 5);
      MapPoint endPointZ = MapPointBuilderEx.CreateMapPoint(20, 1, 5);
    
      Polyline polylineZ = PolylineBuilderEx.CreatePolyline([startPointZ, endPointZ]);
    
      // define a split point
      MapPoint splitPointAboveLine = MapPointBuilderEx.CreateMapPoint(10, 10, 10);
    
      // split the polyline at the point. Don't project the split point onto the line, don't create a new part
      var splitPolyline = GeometryEngine.Instance.SplitAtPoint(polylineZ, splitPointAboveLine, false, false, out bool splitOccurred, out int partIndex, out int segmentIndex);
    
      // splitOccurred = true
      // partIndex = 0
      // segmentIndex = 1
      // splitPolyline.PointCount = 3
      // splitPolyline.PartCount = 1
      // splitPolyline coordinates are (1, 1, 5), (10, 10, 10), (20, 1, 5)
    
      // split the polyline at the point.  dont project the split point onto the line, do create a new part
      splitPolyline = GeometryEngine.Instance.SplitAtPoint(polylineZ, splitPointAboveLine, false, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitOccurred = true
      // partIndex = 1
      // segmentIndex = 0
      // splitPolyline.PointCount = 4
      // splitPolyline.PartCount = 2
      // splitPolyline first part coordinates are (1, 1, 5), (10, 10, 10)
      // splitPolyline second part coordinates are (10, 10, 10), (20, 1, 5)
    
      // split the polyline at the point.  do project the split point onto the line, don't create a new part
      splitPolyline = GeometryEngine.Instance.SplitAtPoint(polylineZ, splitPointAboveLine, false, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitOccurred = true
      // partIndex = 0
      // segmentIndex = 1
      // splitPolyline.PointCount = 3
      // splitPolyline.PartCount = 1
      // splitPolyline coordinates are (1, 1, 5), (10, 10, 5), (20, 1, 5)
    
      // split the polyline at the point.  do project the split point onto the line, do create a new part
      splitPolyline = GeometryEngine.Instance.SplitAtPoint(polylineZ, splitPointAboveLine, false, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitOccurred = true
      // partIndex = 1
      // segmentIndex = 0
      // splitPolyline.PointCount = 4
      // splitPolyline.PartCount = 2
      // splitPolyline first part coordinates are (1, 1, 5), (10, 10, 5)
      // splitPolyline second part coordinates are (10, 10, 5), (20, 1, 5)
    
      //
      // try to split with a point that won't split the line  - pt extends beyond the line
      //
    
      var pointAfterLine = MapPointBuilderEx.CreateMapPoint(50, 1, 10);
      splitPolyline = GeometryEngine.Instance.SplitAtPoint(polylineZ, pointAfterLine, false, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitOccurred = false
      // ignore partIndex, sgementIndex
      // splitPolyline is the same as polylineZ
    
      ///
      ///  multipart polygon
      ///
      List<Coordinate3D> coordsZ =
      [
        new Coordinate3D(10,10,5),
      new Coordinate3D(10,20,5),
      new Coordinate3D(20,20,5),
      new Coordinate3D(20,10,5)
      ];
    
      List<Coordinate3D> coordsZ_2ndPart =
      [
        new Coordinate3D(30,20,10),
      new Coordinate3D(30,30,10),
      new Coordinate3D(35,28,10),
      new Coordinate3D(40,30,10),
      new Coordinate3D(40,20,10)
      ];
    
      var builder = new PolygonBuilderEx
      {
        HasZ = true
      };
      builder.AddPart(coordsZ);
      builder.AddPart(coordsZ_2ndPart);
    
      Polygon multipart = builder.ToGeometry();
    
      // pointA is closer to the first part of the multipart - the split occurs in the first part
      var pointA = MapPointBuilderEx.CreateMapPoint(22, 18, 7);
      var splitPolygon = GeometryEngine.Instance.SplitAtPoint(multipart, pointA, false, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitPolygon.PointCount = 12
      // splitPolygon.PartCount = 2
      // splitPolygon first part coordinates  (10, 10, 5), (10, 20, 5), (20, 20, 5), (22, 18, 7), (20, 10, 5), (10, 10, 5)
    
      // pointB is midPoint between the 2 parts - no split will occur
      var pointB = MapPointBuilderEx.CreateMapPoint(25, 20, 7);
      splitPolygon = GeometryEngine.Instance.SplitAtPoint(multipart, pointB, true, false, out splitOccurred, out partIndex, out segmentIndex);
    
      // splitOccurred = false
      // ignore partIndex, sgementIndex
      // splitPolyline is the same as polylineZ
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also