2

I am a fairly new user of QGIS having a question regarding dissolve functionality.

I am working with the NUTS-2 shapefiles provided by EU, which I have imported in QGIS. To ease the discussion, I have created a new layer with only Denmark and Netherlands as you can see in the picture below.

DK and NL

The corresponding attribute table is the following.

Attribute table

The fields describe the ID and name for each NUTS node, as well as the country code. I have introduced a new attribute field, called Merge_attr.

Based on the aforementioned, I have managed to dissolve the polygons with the same attribute value of Merge_attr. However, I would like to dissolve polygons based on the Merge_attr value only when they belong to the same country and potentially only when they are adjacent.

Is it possible to dissolve or merge polygons that have a "valued" attribute which is not exactly the same but similar (i.e. under some other condition). For example, would it be possible to merge polygons that belong to the same country and the difference of their "Merge_attr" values is smaller than 0.5?

  • 1
    Welcome to GIS SE. As a new user, please take the Tour, which emphasizes the importance of asking One question per Question. We use a "Focused question/Best answer" model, so multiple questions make it difficult to choose among (often partial) answers. Please Edit the Question to ask one question. – Vince Apr 15 at 16:04
  • Also feel free to ask your other questions in separate threads. – MrXsquared Apr 15 at 16:10
  • 1
    The question isn't specific enough, think of the situation where you have candidate polygons A,B,C with attributes 0.1,0.4,0.7. In this case, for a threshold of 0.5, polygon B should be dissolved with A and with C, but A and C must not be dissolved together. The compromise solution will be to add a new column where you group the polygons using intervals of Merge_attr, and dissolve with that column. you shuld look at clustering algorithms if you want to find optimal intervals with certain restrictions in interval length or number of items in an unsupervised way. – Javier JC Apr 15 at 19:48
  • Dissolve will only drop common edges when Polygons are adjacent. Maybe you just need to concatenate Country to the end of Merge_att. You may need to convert to Single Part, at the and, to split Multipart geometries. – klewis Apr 15 at 21:04
  • @klewis Dissolving will create one multipolygon for each common field-value. Even if they are not adjecent. But, if you then do 'multipart to singlepart' you get what you need – PieterB Apr 17 at 7:31
2

You have to do it in two steps. Both algorithms can be found under Processing > Processing toolbox

1/ Dissolve your features based on 2 fields: CNTR_CODE and Merge_attr.

To select the desired fields, click ... next to Dissolve field(s) [optional]

enter image description here

2/ Split the results from step one with multipart to singlepart algorithm.

enter image description here

If it is a repetitive task, you can combine the two algorithms into one, by using the graphical modeller. A good tutorial about this can be found here: https://www.qgistutorials.com/en/docs/3/processing_graphical_modeler.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.