Understanding difference between Polygon and Multipolygon for shapefiles in QGIS?
From a more formal point of view, I report the definition for both a polygon and a multipolygon (the following text and images come from this document of the OGC® Standards, all credits to the cited source).
Polygon
A Polygon is a planar Surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the Polygon.
The exterior boundary LinearRing defines the “top” of the surface which is the side of the surface from which the exterior boundary appears to traverse the boundary in a counter clockwise direction. The interior LinearRings will have the opposite orientation, and appear as clockwise when viewed from the "top".
The assertions for Polygons (the rules that define valid Polygons) are as follows:
- Polygons are topologically closed;
- The boundary of a Polygon consists of a set of LinearRings that make up its exterior and interior boundaries;
- No two Rings in the boundary cross and the Rings in the boundary of a Polygon may intersect at a Point but only as a tangent;
- A Polygon may not have cut lines, spikes or punctures;
- The interior of every Polygon is a connected point set;
- The exterior of a Polygon with 1 or more holes is not connected. Each hole defines a connected component of the exterior.
Below some examples of Polygons:
Multipolygon
A MultiPolygon is a MultiSurface whose elements are Polygons.
The assertions for MultiPolygons are as follows:
- The interiors of 2 Polygons that are elements of a MultiPolygon may not intersect;
- The boundaries of any 2 Polygons that are elements of a MultiPolygon may not “cross” and may touch at only a finite number of Points;
- A MultiPolygon is defined as topologically closed;
- A MultiPolygon may not have cut lines, spikes or punctures, a MultiPolygon is a regular closed Point set;
- The interior of a MultiPolygon with more than 1 Polygon is not connected; the number of connected components of the interior of a MultiPolygon is equal to the number of Polygons in the MultiPolygon
The boundary of a MultiPolygon is a set of closed Curves (LineStrings) corresponding to the boundaries of its element Polygons. Each Curve in the boundary of the MultiPolygon is in the boundary of exactly 1 element Polygon, and every Curve in the boundary of an element Polygon is in the boundary of the MultiPolygon.
Below some examples of MultiPolygons:
Shapefile polygons are constructed from one or more closed rings. If a shape has multiple rings, they can be exterior and interior (e.g., form a doughnut), or multiple exterior (e.g., island chain).
Of course, having multiple exteriors doesn't prevent having one or more interior rings on each shape. The shapefile specification does state that:
- Exterior rings must be clockwise, while interior rings must be counter-clockwise (this convention is known as right-hand rule since the shape would always be on your right-hand side as you walk the perimeter; unfortunately, it can also be known as left-hand rule, because the exterior rings follow the direction of a curled left hand with the thumb pointed upward from the top of the figure)
Interior rings must always follow the exterior ring they partition"The order of rings in the points array is not significant." (though in practice, at least for Esri-generated shapefiles, interior rings nearly always follow the exterior ring they partition)- Neither exterior or interior rings may overlap or share a common border (such features may be populated, but they are invalid and may cause strange geoprocessing failures).
Shapefiles do not make a distinction between these objects -- they are all polygons (and each geometry is associated with one dBase record).
However, some tools do make a distinction, QGIS being one of them. If all you will ever have in a shapefile is simple one-ring shapes, then you can safely choose Polygon. If the shapes may contain "holes", it is also safe to choose Polygon. If, however, some shapes may contain multiple exterior rings then you need to choose Multipolygon.