I'm trying to combine the features from a layer in QGIS by distance. Basically I have the following layer with some features.

qgis with layer features

I wanted to remove the small gaps (as seen in below image) between them.

small gaps between features

But I'm not finding a way to resolve this, I already tried the solutions from this answer -> https://gis.stackexchange.com/a/69509/205547 but it doesnt seems to work. I also tried to use the v.clean function, but that also didn't work.

Basically the layer would be filled like the bellow image if I removed the gaps by a certain distance. enter image description here

Is there a way to remove those gaps by certain threshold?

edit 1:

So i was playing with @Maximilien jaffrès answer and got some interesting results using the Buffer. I measured a distance between two features and tried to use that distance as a parameter to "join" them. distance between features

I got what i was looking for but the outer boundaries changed as seen below. outer boundaries changed

In that case the "outer" boundaries should remain the same and the "inner" boundaries should get snapped.

Even though @BERA answer would work perfectly, it would take more time to achieve in cases where there be more features (usually the user import a file with 2-5 groups of multiple features).

Considering that i gave a shot at @MrXsquared answer and i got a good result as seen below. inner boundaries changed, outer boundaries ramained

Some outer boundaries got changed as well, but with that i can simply merge the original with the snapped, apply a v.clean and dissolve them, the result is the below.

enter image description here

  • 2
    add a buffer to this layer ? vector => add buffer and define a distance that would be your treshold. To only close the gap , you do buffer and then reverse the buffer May 13, 2022 at 13:09
  • 1
    If those are your only features, start editing and fix them manually. Draw a new feature covering the gaps, merge it with existing
    – BERA
    May 13, 2022 at 13:14
  • 1
    You can also give "snap geometries to layer" a try to remove the gaps. This way you dont need to buffer on all sides and build a difference after that.
    – MrXsquared
    May 13, 2022 at 15:18
  • Just to speak about your edit, when you have the outer boundaries that has changed , one step you can add is to do again a buffer with the same offset but negative, you should have your boundaries back ... on a pedantic note it's a technique called erosion of polygon (buffer + with dissolve then same buffer but minus the offset). May 16, 2022 at 13:40


Your Answer

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

Browse other questions tagged or ask your own question.