Friday 22 November 2019

arcmap - 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:


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?




Answer



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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...