ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / Reshape Method
The geometry to be reshaped.
The reshaper.
Example

In This Topic
    Reshape Method (IGeometryEngine)
    In This Topic
    Reshapes a polygon or polyline with a single path polyline.
    Syntax

    Parameters

    multipart
    The geometry to be reshaped.
    reshaper
    The reshaper.
    Exceptions
    ExceptionDescription
    Either multipartor reshaperor both are null.
    Incompatible spatial references between the input geometries.
    The reshaper polyline must have exactly one part.
    Remarks
    The output geometry takes the shape of the input multipart where it first intersects the reshaper to the last intersection. The first and last intersection points of the reshaper are chosen closest to the end points of the reshaper in the case that multiple intersections are found. The output geometry may not be simple. If the geometry cannot be reshaped by the input reshaper, then null will be returned.
    Example
    Reshape a polygon
    List<Coordinate2D> polygon1Coords = new List<Coordinate2D>()
    {
      new Coordinate2D(0, -11000),
      new Coordinate2D(1000, -11000),
      new Coordinate2D(1000, -12000),
      new Coordinate2D(0, -12000),
      new Coordinate2D(0, -11000)
    };
    
    // reshaper coordinates intersect the polygon
    List<Coordinate2D> reshaperCoords = new List<Coordinate2D>()
    {
      new Coordinate2D(1500, -11800),
      new Coordinate2D(-2600, -11800)
    };
    
    SpatialReference sr = SpatialReferenceBuilder.CreateSpatialReference(102010);
    Polygon polygon1 = PolygonBuilderEx.CreatePolygon(polygon1Coords, sr);
    Polyline reshaper = PolylineBuilderEx.CreatePolyline(reshaperCoords, sr);
    
    Polygon outPolygon = GeometryEngine.Instance.Reshape(polygon1, reshaper) as Polygon;
    // outPolygon.PartCount = 1
    
    ReadOnlySegmentCollection segments = outPolygon.Parts[0];
    // segments.Count = 4
    // outPolygon.PointCount = 5
    
    string json = GeometryEngine.Instance.ExportToJson(JsonExportFlags.JsonExportSkipCRS, outPolygon);
    // json = "{\"rings\":[[[0,-11800],[0,-11000],[1000,-11000],[1000,-11800],[0,-11800]]]}";
    
    
    // example where the Reshaper polyline doesn't intersect the input
    
    reshaperCoords.Clear();
    reshaperCoords.Add(new Coordinate2D(1000, 1000));
    reshaperCoords.Add(new Coordinate2D(2000, 1000));
    
    reshaper = PolylineBuilderEx.CreatePolyline(reshaperCoords, sr);
    
    outPolygon = GeometryEngine.Instance.Reshape(polygon1, reshaper) as Polygon;
    // outPolygon = null
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also