54

Creating Scratch layer gives me a choice between Polygon and Multipolygon, so I started wondering how should I make use of them.

New Temp Scratch Layer

Reading a new book "Mastering QGIS" (through this answer by Joseph to What does buffer mean in QGIS Voronoi dialog?), authors' comment was "ESRI shapefiles store geospatial data in multi- type geometry, so using multi- type geometry is a good practice if you plan on converting between formats."

How should I choose one of them (Polygon or Multipolygon) when I create a new polygon layer? (I had confused multi-polygon with multipart-polygon, so I used to choose Polygon.)

One recent situation I have come to choose Polygon/Multipolygon was Changing parallel line length to split polygon in QGIS? in which I draw a dummy polygon as a background layer. Working mainly on shapefiles it seemed I was supposed to choose Multipolygon, although I needed only one polygon. In this case what I needed was simple polygon geometry without any attribute (Not sure this example make any distinction.)

5
  • You haven't provided enough information to help you choose. Please edit the question to specify what the scratch layer is due to contain. Note that the book is misleading, in that shapefiles don't store multi-type geometries; instead they just do not make a distinction between single- and multi-part lines or polygons.
    – Vince
    Commented Jan 22, 2017 at 2:20
  • @Vince Thanks. I added a recent experience in which I needed to choose one of them. Not sure if this simplistic example makes any sense.
    – Kazuhito
    Commented Jan 22, 2017 at 2:37
  • @Vince As to the latter part of your comment, is it that I do not have to worry about single- or multi-, as far as I am going to save the layer as shapefile to disk?
    – Kazuhito
    Commented Jan 22, 2017 at 2:44
  • I converted all my Multipolygons to Ploygons in The GEOTIF gis changed them back after some time had occured I presume therefore this is what they should all be now
    – Martin
    Commented May 29, 2020 at 9:52
  • @Martin Thanks for your comment. My question was about vector polygon/multipolygon difference. Geotiff - raster polygon - was out of my focus.
    – Kazuhito
    Commented May 29, 2020 at 23:06

2 Answers 2

81

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:

  1. Polygons are topologically closed;
  2. The boundary of a Polygon consists of a set of LinearRings that make up its exterior and interior boundaries;
  3. 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;
  4. A Polygon may not have cut lines, spikes or punctures;
  5. The interior of every Polygon is a connected point set;
  6. 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:

enter image description here


Multipolygon

A MultiPolygon is a MultiSurface whose elements are Polygons.

The assertions for MultiPolygons are as follows:

  1. The interiors of 2 Polygons that are elements of a MultiPolygon may not intersect;
  2. 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;
  3. A MultiPolygon is defined as topologically closed;
  4. A MultiPolygon may not have cut lines, spikes or punctures, a MultiPolygon is a regular closed Point set;
  5. 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:

enter image description here

9
  • +1 Thank you so much! It's so helpful. It must have taken a long time to summarize them in such a concise style, I cannot imagine how I could do it... So it seems to be a Collection set of Polygons, a Set of Surfaces, and supported by rather loose guideline in terms of topology (just my first impression). I will read and re-read linked material, it is very interesting!
    – Kazuhito
    Commented Jan 22, 2017 at 16:21
  • I think you need to think about a multipolygon from a geometrical point of view. The most clear difference I see is that, starting from any location on the polygon surface, you may reach any other location on it, while for a multipolygon is not always true (see for reference the last examples for both categories in the above attached images).
    – mgri
    Commented Jan 22, 2017 at 16:33
  • 2
    What makes the first MultiPolygon example belong there?
    – Stijn
    Commented Aug 21, 2017 at 6:19
  • 1
    @Stijn the first example is a multipolygon because, in some cases, two points within it may be connected by a line that is not entirely contained within the polygon itself. This behavior is not allowed for a polygon, so it is a multipolygon.
    – mgri
    Commented Aug 21, 2017 at 13:36
  • 1
    @mgri "two points within it may be connected by a line that is not entirely contained within the polygon itself. This behavior is not allowed for a polygon" then why the leftmost polygon in your first picture is a polygon? Shouldn't it be a multipolygon? How to define "within" ?
    – P Li
    Commented Feb 10, 2021 at 5:27
31

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). enter image description here

Of course, having multiple exteriors doesn't prevent having one or more interior rings on each shape. The shapefile specification does state that:

  1. 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)
  2. 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)
  3. 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.

10
  • 3
    This is great in-depth summary about shapefile, Thank you so much! I now understand most of my past experience fall within usage of Polygon. In future I will use Multipolygon when I need to digitize holes, something like lakes. Thank you again!
    – Kazuhito
    Commented Jan 22, 2017 at 3:18
  • 3
    Thanks for adding figure, so the one at the right-hand-side is the multiple exterior ring, for which I need to choose Multipolygon... not the one at the center with the hole!
    – Kazuhito
    Commented Jan 22, 2017 at 4:18
  • 3
    I've got to go back and label them, but yes, the green polygon is the only Multipolygon
    – Vince
    Commented Jan 22, 2017 at 4:21
  • 1
    In the case of Two Rings (Multipolygon), would these two rings share the same record if we see the attribute table? (i.e. the shapefile has only one record)?
    – Kazuhito
    Commented Jan 22, 2017 at 4:24
  • 1
    Yes, it is one geometry in one record
    – Vince
    Commented Jan 22, 2017 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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