Friday, 2 December 2016

shapefile - How to merge and dissolve adjacent polygons and sum up their attributes in QGIS?


I have many polygons that are adjacent to each other, and others overlap slightly. I need to merge them and sum up their attribute (Area per class). I attach an image of my problem (Screenshot of my merged polygons. Each color represents a landcover class)



I am able to merge the polygons using the function "merge Layers" from the MMQGIS plugin. But the adjancent polygons of the same type are not dissolved, nor their Area summed up.


I tried already using the function Dissolve (per Area) and doesn´t work either.


I am beginner in QGIS. I am working in QGIS 2.12.3 in a PC.


Screenshot of my polygons merged. Each color represent a landcover class



Answer



Thanks to the comment of @Ed Rollason I used the Topology checker to understand where was my problem.


Ok, as I said, my layers overlap. But they overlap like a zipper (one on top of each other). After trying many tools (union, difference, merge, dissolve) without success, I found a video that explains the v.clean tool of the Process Toolbox.


In QGIS 2.12.3, go to Processing > Toolbox > GRASS Commands > Vector. I tried v.clean tool like in the video, but I had some geometry errors. Therefore, I used v.dissolve, tolerance = 1 and afterwards the Dissolve tool for a final clean up of the image.


Regarding the attributes, I have the total area of each class.


Link to the video: https://www.youtube.com/watch?v=t1ChPvsC4bU



enter image description here


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...