ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Geometry Namespace / Polygon Class / GetExteriorRing Method
The index of the exterior ring. Note that this is not the index of the part in the polygon. Use ExteriorRingCount to determine the number of exterior rings in this polygon.
(Optional) Determines if the spatial reference should be set in each of the returned polygons. If setSpatialReference is set to true, then the spatial reference in each polygon is inherited from this polygon. If setSpatialReference is set to false, then the spatial reference in each polygon is set to null. The default value is true.
Example

In This Topic
    GetExteriorRing Method
    In This Topic
    Gets the specified exterior ring in this polygon.
    Syntax
    public Polygon GetExteriorRing( 
       int index,
       bool setSpatialReference
    )
    Public Function GetExteriorRing( _
       ByVal index As Integer, _
       Optional ByVal setSpatialReference As Boolean _
    ) As Polygon

    Parameters

    index
    The index of the exterior ring. Note that this is not the index of the part in the polygon. Use ExteriorRingCount to determine the number of exterior rings in this polygon.
    setSpatialReference
    (Optional) Determines if the spatial reference should be set in each of the returned polygons. If setSpatialReference is set to true, then the spatial reference in each polygon is inherited from this polygon. If setSpatialReference is set to false, then the spatial reference in each polygon is set to null. The default value is true.

    Return Value

    A polygon representing the exterior ring.
    Exceptions
    ExceptionDescription
    The index is negative or is greater than or equal to the number of external rings in this polygon.
    Remarks
    An exterior ring is a part that is oriented clockwise.
    Example
    Get the exterior rings of a polygon - polygon.GetExteriorRing
    public void GetExteriorRings(Polygon inputPolygon)
    {
      if (inputPolygon == null || inputPolygon.IsEmpty)
        return;
    
      // polygon part count
      int partCount = inputPolygon.PartCount;
      // polygon exterior ring count
      int numExtRings = inputPolygon.ExteriorRingCount;
      // get set of exterior rings for the polygon
      IList<Polygon> extRings = inputPolygon.GetExteriorRings();
    
      // test each part for "exterior ring"
      for (int idx = 0; idx < partCount; idx++)
      {
        bool isExteriorRing = inputPolygon.IsExteriorRing(idx);
        var ring = inputPolygon.GetExteriorRing(idx);
      }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also