6

I'm wondering about the ESRI shapefile with shape type 5.

When reading the spec I see that "A polygon may contain multiple outer rings.". Does this mean that these outer rings must be combined to form a polygon or does it mean that it is in fact a "MultiPolygon" type? So that multiple polygons can be in one entry?

EDIT: Background => I'm writing a reader for shapefiles.

  • Are you thinking of "combined" in a way that you have several non-closed lines, that will form a single polygon without holes? – AndreJ Nov 20 '14 at 11:20
  • I think all lines must be closed, I'm thinking of multiple lines which each don't overlap and aren't inside of one another. – Johan S Nov 20 '14 at 11:23
  • 1
    The spec is explicit. Polygon shapefiles are composed of a list of rings. Right hand rule rings are outer polygon parts, and left hand rule rings are holes. The first ring must be outer. Hole rings follow their parent outer rings. "Multipolygon" didn't exist as a term of art when the shapefile spec was written. – Vince Nov 20 '14 at 12:07
  • @Vince, I don't think that is the case for polygons, I think you are thinking of MultiParts? – Johan S Nov 21 '14 at 7:34
  • @Vince however, it seems that the vertex order tells us if the polygon is an outer or inner ring. – Johan S Nov 21 '14 at 8:54
5

From the GDAL page for the Shapefile driver:

SHPT_POLYGON shapefiles, reported as layers of type wkbPolygon, but depending on the number of parts of each geometry, the actual type can be either OGRPolygon or OGRMultiPolygon.

So the answer to your question is YES ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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