4

Is there a way in QGIS to dissolve a vector by two or more fields?

  • 2
    Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark Nov 3 '16 at 18:08
4

This is a new feature in QGIS 2.18. You can check the changelog here.

The dissolve algorithm now allows you to dissolve based on more than one field value. In previous QGIS versions a dissolve could only group features by a single field value.

  • ... which is not available for OS X yet :-/ – Stophface Nov 3 '16 at 11:59
  • It looks like it is, depending on what installer package you want to use. Sadly I have zero experience with MACs so I don't know what's involved with that kind of installation – Knightshound Nov 3 '16 at 12:08
2

Something like this should work with ogr2ogr:

ogr2ogr -f "ESRI Shapefile" -dialect sqlite -sql "select st_union(geometry) as geometry,attribute_1 a,attribute_2 b from my_data group by a,b order by a,b" my_data.shp

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.