I have a shapefile in QGIS and I want to dissolve it with the options:

A field named 'specialid' has the same value

A field named 'city' has different value

Ok the first is very easy. It is basically what dissolve is meant to be So all same specialid will be unified. But I want those with the same 'specialid' and different 'city' value NOT to be dissolved. How can I process the second option? Is there a way to select it or do it another way?

  • 1
    If you can't dissolve on two fields, you can do the complex encoding into a new field, and use that. – Vince Apr 16 '19 at 14:13
  • What do you mean? Yes basically I want to dissolve on two fields at the same time – GeoF Apr 16 '19 at 14:26
  • ArcGIS lets you choose multiple dissolve columns, but before that, you needed to do a frequency on the column list, join the frequency ID back into the table, then dissolve on that. You can create a new column which merges the columns on which you want to dissolve, then Dissolve on that. – Vince Apr 16 '19 at 14:35
  • the question is unclear. first you say you want to dissolve where "'A field named 'city' has different value". And then further below you say if city value is different, then NOT to dissolve. This is why the answer below fits your second description, but not the top description. – Marshall Apr 16 '19 at 18:57

The Dissolve tool allows you to dissolve features based on one or more fields.

This algorithm takes a vector layer and combines their features into new features. One or more attributes can be specified to dissolve features belonging to the same class (having the same value for the specified attributes), alternatively all features can be dissolved in a single one.

enter image description here

Select "specialid" and "city" as the dissolve fields. Features with matching "specialid" AND "city" values will be dissolved.


  • Feature1 has "specialid"=1 and "city"='chicago'
  • Feature2 has "specialid"=1 and "city"='chicago'
  • Feature3 has "specialid"=2 and "city"='new york'
  • Feature4 has "specialid"=2 and "city"='chicago'

Feature1 and Feature2 will be dissolved. Feature3 and Feature4 will remain separate.

| improve this answer | |

As Vince mentioned another way of doing it would be to add a new column that specifies the features to be merged by combining the respective values of both attributes.

In QGIS do the following:
1) activate editing mode for layer to be edited
2) open field calculator and add new field (string) with the following command: "specialid" + '_' + "city"
3) dissolve over the newly created field

| improve this answer | |

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.