# Nested polygons, splitting by smallest to biggest using QGIS

I have drainage catchments that sit within each other (i.e. a primary, secondary and major catchment area, nested). At the moment, if I was to click info in the red area in the example below, it would return three results (red, green, blue). In the green area I'd get two results (blue, green) and in the blue, just one result (blue). I'd like these separated out, so that the smallest (red) retains its shape, the next largest (green) is clipped to the smallest (red) and the largest (blue) is clipped to the green. Ultimately, I just need one answer in each polygon area.

Let's assume there is a polygon layer called 'overlaps' with its attribute table, see image below.

Step 1. Perform an intersection by means of the SAGA's "Polygon Self-Intersection" geoalgorithm

Step 2. Make use of the "Extract by expression" geoalgorithm with this expression:

``````regexp_match("ID",'\\|') or not is_empty_or_null(\$geometry)
``````

and get the output

Additionally, the application of the "Join attributes by location" geoalgorithm can be relevant to get the initial attributes back.

• Please review OP's comment under my answer. Dec 2 '21 at 2:10
• Thank You Taras - I appreciate the above! It's given me something to work with. Much appreciated.
– Luke
Dec 6 '21 at 23:01

You can use "GRASS > Vector > v.clean" and "Vector general > Delete duplicate geometries" tools, respectively.

• In `v.clean` window, click `break` as "Cleaning tool". This tool might generate some duplicate geometries.

• Then, use "Delete duplicate geometries" tool.

• Thanks Kadir! This looks like it will work very well. I just need one more thing to make it correct. Each of the duplicate geometries have kept the area of the original catchment. When using the 'Delete Duplicate Geometries' I want to keep the smallest area of the duplicates. I tried using the 'Order by expression' tool first to order them smallest to largest and then delete duplicates but that didn't work. Any ideas on how to delete the duplicate geometries, keeping the smallest result from the area attribute? Many thanks again.
– Luke
Nov 30 '21 at 23:01
• Duplicate polygons have the same area. Nov 30 '21 at 23:45
• Thanks Kadir - The original overlapping polygons had an area (with the example above, the blue was 100 ha, the green is 60 ha and the red is 20 ha). In the green, I'd have the areas 100ha and 60ha on the original attributes for the two polygons, the actual new shape has a new area all together (say 20ha) - for this one I'd like to delete the duplicate, and keep the one that has the 60 ha attribute. I hope that makes sense!
– Luke
Nov 30 '21 at 23:55
• You didn't mention that in your question body. Dec 1 '21 at 9:10

Extract the boundaries of the polygons as lines, cut the polygons with these lines and delete duplicate geometries:

1. Menu Vector / Geometry Tools / Polygons to Lines

2. Menu Processing / Toolbox / Split with lines

3. Menu Processing / Toolbox / Delete duplicate geometries