2

How can I merge not overlapping polygons? I'm trying to set up a model that merges polygons that are within 500m from each other, at the closest edge of the polygon.

I have tried with the shortest line between features, but don't know how to extract the length from the line and add it to the polygons so to try to use the merge polygon feature if possible.

is there an easier way?

enter image description here

I was looking for something like aggregate polygons that you find in ArcGIS. Figured I could use join attributes to the nearest directly on the polygon and then remove duplicated.

2
  • if i use buffer the polygons are going to cover area that are not supposed to be a part in futher calculations.
    – Endre Aaen
    Commented Sep 19, 2023 at 11:14
  • How is this supposed to work? If you have 3 polygons, for example, with one that is within 500m of the two others but the two others aren't, should all 3 be fused into 1? What if this is the case but for 50 polygons? Or are you expecting that fusion will happen only between polygon pairs with certain polygons being fused more than once?
    – Gabriel
    Commented Sep 19, 2023 at 12:52

2 Answers 2

2

It is not in QGIS, but if you can run standalone python scripts you could try the (new) dissolve_within_distance feature of geofileops.

It offers a basic subset of features of "aggregate polygons", but it sounds like it supports what you are looking for.

import logging
import geofileops as gfo

if __name__ == "__main__":
    # Init logging so progress printed by gfo is shown
    logging.basicConfig(level=logging.INFO)

    input_path = "/path/you/like/zones.gpkg"
    output_path = "/path/you/like/zones_dissolved.gpkg"
    gfo.dissolve_within_distance(
        input_path=input_path, output_path=output_path, distance=500
    )

Disclaimer: I am the developer of geofileops.

1

Do you mean 500m from the closest points of two polygons, or centroids?

What about using buffer? You could create a layer that adds buffers of 250m based on your polygons. Then all buffer polygons that touch should be merged.

Then, one would need to keep track of which polygons in the buffered layer are merged and do a corresponding merge in the original layer, which would then be multipolygons.

Sorry if the answer is a bit unclear, it is just an idea of what you could try.

1
  • 2
    Answers should answer a Question. If all you have is questions for the OP, it is not yet Answer-ready.
    – Vince
    Commented Sep 19, 2023 at 11:11

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.