Saturday 22 August 2015

qgis - How to merge single polygons to multi part polygons by maximum distances?


I have a polygon layer with a land-use class and ID for every polygon. How can I merge polygons (into multi part polygon) which do not adjoin, but are not further than x meters apart from each other.


As an example you can imagine two forest polygons which are separated by a road. I would like the two forest polygons to be one multi-part polygon.


Of course one can merge two polygons by hand, but this would take forever!


Clarification: In case two forest polygons are separated more than x meters, e.g. a 100m broad meadow, I would like to keep the two separate forest polygons.


I am using this map for the ecological modeling of animals. This is why habitat patches need to be defined. Basically this process decides if two polygons are still the same habitat or two separate habitats.



Answer




I would make a new layer by buffering your polygons by x-meters and checking the 'dissolve' option. Make sure your new layer is singlepart geometry and then give each of your buffered polygons a unique ID. Next perform a spatial join of your buffers on your original polygons to attribute the originals with the ids from your buffers. Finally dissolve your original polygons using the new attribute.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...