# How many interior and exterior rings can a polygon have in a standard ArcGIS shapefile?

working with GDAL/OGR library and studying these two slides about geometries and vector data in the OGR library:

I found that a polygon can have an exterior ring and lots of interior rings for an arbitrary format that OGR supports.
But I'm developing a program that will support only ESRI's point, line and polygon shapefiles.
For testing my program, I decided to draw a polygon shapefile in the Arcmap with the Editor that will have ten polygons and each polygon will have different numbers of interior rings.
But as much as I play with the editor trying to create a polygon that has one interior ring ( for example I created two polygons - one inside another - and then merged them together ), I couldn't create such polygon.

So could you tell me :

• How many exterior and interior rings can a polygon have in an ESRI's polygon shapefile ?
• How can I create a polygon that has 1 exterior and 2 interior rings with the editor in Arcmap?
• @Jens has answered your second question which I recommend you Accept. I think your first question should be posted as a New Question to maintain a clean Q&A format.
– PolyGeo
Sep 12, 2013 at 10:32

Quoting the shapefile specification:

A polygon consists of one or more rings. A ring is a connected sequence of four or more points that form a closed, non-self-intersecting loop. A polygon may contain multiple outer rings. The order of vertices or orientation for a ring indicates which side of the ring is the interior of the polygon. The neighborhood to the right of an observer walking along the ring in vertex order is the neighborhood inside the polygon. Vertices of rings defining holes in polygons are in a counterclockwise direction. Vertices for a single, ringed polygon are, therefore, always in clockwise order. The rings of a polygon are referred to as its parts.

So, by definition, a polygon must have at least one exterior ring. Interior rings (aka "holes") can only exist within a parent exterior ring. If there are multiple exterior rings, they can touch each other at a single point, but they cannot share a boundary or overlap. Interior rings must be wholly contained within their parent rings (they cannot touch the exterior ring at all), and can only touch other interior rings at a single point (again, no shared segment or overlap). Interior rings are distinguished from exterior rings by vertex order (clockwise for exterior and counter-clockwise for interior, as per "right hand rule"). There is no upper limit to the number of exterior rings, or to the number of interior rings within any given exterior ring (though file size limitations would impose an upper limit if you work it backwards, four points per ring, sixteen bytes per point -- roughly 33.5 million rings).

• thanks for your explanation and also for the pdf that you have linked. It was really helpful. Sep 12, 2013 at 14:44
• ok then @Vince as you say I was wrong and a polygon can have multiple exterior rings just like interior ones. But if you are familiar with open source GIS software developement and the GDAL/OGR library the `OGRPolygon` class has just a function `getNumInteriorRings` for getting the number of interior rings of a polygon and no such function for getting the number of exterior rings! So can you tell me how can I support multiple exterior rings in ogr or introduce me another open source library that supports multiple exterior as well as interiors? Sep 12, 2013 at 16:12
• I've never used that API, but the documentation states "A polygon cannot represent disconnected regions (such as multiple islands in a political body). The OGRMultiPolygon must be used for this." Sep 12, 2013 at 17:18
• gdal.org/ogr/classOGRPolygon.html Sep 12, 2013 at 17:54
• @yo_haha I read that to say a polygon has one exterior ring, and treats multi-part polygons as a list/array of polygons. The shapefile specification does not distinguish between single- and multi-part lines or polygons (only multi-part points, which are stored differently than points). Jan 23, 2015 at 17:23

To create multipart polygons or donut polygons you have to use the command Finish Part.

For a donut polygon:

1. draw a new polygon without finishing the sketch
2. right-click and click Finish Part
3. draw new polygon inside your first polygon to create a hole
4. finish the sketch.

For a multipart polygon:

1. draw a new polygon without finishing the sketch
2. right-click and click Finish Part
3. draw new polygon beside your first polygon
4. finish the sketch.