Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

slide 1
slide 2

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?
share|improve this question
2  
@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 '13 at 10:32

2 Answers 2

up vote 2 down vote accepted

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).

share|improve this answer
    
thanks for your explanation and also for the pdf that you have linked. It was really helpful. –  sepideh Sep 12 '13 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? –  sepideh Sep 12 '13 at 16:12
1  
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." –  Vince Sep 12 '13 at 17:18
    
can you link the documentation where you have read A polygon cannot represent disconnected regions (such as multiple islands in a political body). The OGRMultiPolygon must be used for this thanks @Vince –  sepideh Sep 12 '13 at 17:45
1  
gdal.org/ogr/classOGRPolygon.html –  Vince Sep 12 '13 at 17:54

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.

In ArcGIS help you find more information how to create a donut holes and how to create a multipart polygon.

(I do not know if there is a limit for the number of holes or multipart polygons.)

share|improve this answer
    
thanks for your explanation and also the links that you have provided. It was really a great help. –  sepideh Sep 12 '13 at 16:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.