6

I have a polygon layer and want to check if there are some polygons overlapping within the same layer. How can I do this?

In ArcGIS, I could run the Intersect tool only by adding the layer I want to check. This doesn't work in QGIS because it requires an overlaying layer.

I tried to add the Topology check "overlap", but this only finds overlapping errors of newly drawn polygons, not existing ones.

I also tried the "Select by Attribute" with overlay_within(@layer) but:

  • It only finds completely overlapping (identical) polygons (I also need to find the polygons that overlap only slightly)
  • It does not create a layer (which would be handy)
Taras
35.8k5 gold badges77 silver badges152 bronze badges
asked Sep 12, 2023 at 8:49
0

5 Answers 5

7

You can create a Virtual Layer with DB Manager which joins the table to itself on intersecting polygons, where the id isnt the same.

You need a unique identifier field, mine is named id. My layer is named qwerty. Modify layer name (row 3 and 4) and the id column name (row 6) in the query below and execute:

select row_number() over() as newid, 
 st_intersection(a.geometry, b.geometry) as geometry
from "qwerty" as a
join "qwerty" as b
on st_intersects(a.geometry, b.geometry)
and a.id<>b.id
where st_area(st_intersection(a.geometry, b.geometry))>0

enter image description here

The same logic using QGIS processing tools:

  1. Field calculate the integer field tempid as @row_number
  2. Intersection (multiple) with Field calculator output as input and overlay layer
  3. Extract by expression "tempid"<"tempid_2"

enter image description here

answered Sep 12, 2023 at 10:55
0
6

You can use the Polygon Self-Intersection tool if you have SAGA installed.

enter image description here

  • Polygons: the input polygon layer
  • Identifier: the field name that you want to use to identify the intersected polygons.
  • Intersection: The output intersected polygons.

Then open the attribute table and in the newly added field, look at the attribute values where the pipe character exists |. These are the polygons that have self-intersections.

Example:

Original polygons:

enter image description here

After running the tool:

enter image description here

answered Sep 12, 2023 at 23:15
0
4

I suggest you run join attributes by location, with both inputs being your polygon layer, using "overlap" as condition and discard all features which haven't been joined to something. Now you're left with all the overlapping features.

If you really need only the overlapping parts, we need to go down the rabbit hole (at least a bit).

  1. Add the $area to your polygons.
  2. Then run union with your overlapping polygons as both inputs.
  3. Select by expression all polygons in your "unionized" layer with an area = 0 or an area equal to the area added in step 1.
  4. Delete the selected polygons.
  5. Run delete duplicate geometries on the overlaps you got.

This probably is also possible using expressions, overlay_intersects or aggregate and whatsoever, but I prefer a working solution over something I need to fiddle around with two hours.

answered Sep 12, 2023 at 10:28
4

You can use the expression

array_length(overlay_intersects(@layer,$id))>0

Either use it via Select by Expression or run it in Extract by Expression to create a new layer containing the overlapping polygons.

Depending on your exact usecase, you may also want to try one of the other overlay expressions.

answered Sep 12, 2023 at 21:09
0
2

You can download the LF Tools plugin and run the Overlapping polygons tool.

I made a scratch layer with overlapping polygons (brown polygons) then ran the tool and it made a new layer of the parts that overlapped (maroon polygons) enter image description here

enter image description here

answered Sep 12, 2023 at 21:46
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.