ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / ConstructPolygonsFromPolylines Method
The set of polylines to create polygons from. If a polyline has curves, a densified copy of it is used to construct the polygons.
Example

In This Topic
    ConstructPolygonsFromPolylines Method (IGeometryEngine)
    In This Topic
    Generates polygons from a set of polylines.
    Syntax
    Function ConstructPolygonsFromPolylines( _
       ByVal polylines As IEnumerable(Of Polyline) _
    ) As IReadOnlyList(Of Polygon)
    IReadOnlyList<Polygon> ConstructPolygonsFromPolylines( 
       IEnumerable<Polyline> polylines
    )

    Parameters

    polylines
    The set of polylines to create polygons from. If a polyline has curves, a densified copy of it is used to construct the polygons.

    Return Value

    Returns the polygons. If none are created, then the collection returned is empty.
    Exceptions
    ExceptionDescription
    The polylines is null.
    Remarks
    The polylines may cross rather than be connected from end to end.

    ConstructPolygonsFromPolylines

    Example
    Construct a Polygon from a set of Polylines
    {
        List<Coordinate2D> firstLinePts = [new Coordinate2D(1.0, 1.0), new Coordinate2D(1.0, 4.0)];
    
        List<Coordinate2D> secondLinePts = [new Coordinate2D(4.0, 4.0), new Coordinate2D(4.0, 1.0)];
    
        List<Coordinate2D> thirdLinePts = [new Coordinate2D(0.0, 2.0), new Coordinate2D(5.0, 2.0)];
    
        List<Coordinate2D> fourthLinePts = [new Coordinate2D(0.0, 3.0), new Coordinate2D(5.0, 3.0)];
    
        // build the polylines
        List<Polyline> polylines =
        [
          PolylineBuilderEx.CreatePolyline(firstLinePts),
      PolylineBuilderEx.CreatePolyline(secondLinePts),
      PolylineBuilderEx.CreatePolyline(thirdLinePts),
      PolylineBuilderEx.CreatePolyline(fourthLinePts),
    ];
    
        // construct polygons from the polylines
        var polygons = GeometryEngine.Instance.ConstructPolygonsFromPolylines(polylines);
    
        // polygons.Count = 1
        // polygon coordinates are (1.0, 2.0), (1.0, 3.0), (4.0, 3.0), (4.0, 2.0)
      }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also