My task is to generate all data individually to a file that touches each other. I first use overlay_touches(@layer) to get what I need, but I couldn't find a method to identify them into different group.

For example, the following pic would be 5 groups, ideally. Right now I could only think of manually select a group and extract selected features to each ones, which is impractical since the data would contain thousands of it. How do I do it? (Even getting the boundries of each groups is fine, since I could loop the process programmatically by PyQGIS).

enter image description here

1 Answer 1


1 Dissolve the layer with advanced parameter keep disjoint feature separate checked.

2 Field calculate the integer field neighborhood as @row_number. Each dissolved separate cluster of polygons will be assigned an individual id.

3 Join the neighborhood attribute to the start layer with "Join attributes by location"

4 "Split vector layer" with neighborhood as unique id field:

enter image description here

  • 1
    Exactly what I need, bravo!
    – Cookie
    Commented Jun 2, 2023 at 11:52

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.