eyecatch

How to Dissolve Polygons by Attribute in QGIS

Published: Last updated:
This article uses QGIS 3.40. The current LTR is 3.44.

What you'll learn


  • The basics of using the Dissolve tool
  • Steps for merging features based on an attribute
  • How to handle attributes after dissolving

Recommended for


  • Anyone who wants to combine regional divisions or administrative boundaries, such as merging municipality data into prefectures
  • Anyone who wants to aggregate polygons by attribute
  • Anyone who wants to learn the basics of geometry operations

Introduction

QGIS has a feature called dissolve, which merges adjacent polygons or lines that share an attribute. It is useful for aggregating and restructuring data, such as combining municipality data into prefectures.

This article introduces how to merge features based on an attribute with the Dissolve tool in QGIS.

What is dissolve?

Dissolve is a process that merges features with the same value in a specified attribute into a single geometry. It works on polygons, lines, and points, but it is most commonly used on area data such as administrative boundaries.

Take a layer of municipal administrative areas as an example. You can merge polygons that are divided by municipality into one polygon per prefecture.

Result of dissolving municipality polygons by prefecture
Result of dissolving municipality polygons by prefecture

Administrative area layers may also split a municipality into several features because of exclaves or remote islands. Dissolve merges them into one feature.

In the data for Aichi Prefecture, for example, Tokoname City is split into four features because it includes exclaves such as Chubu Centrair International Airport.

Tokoname City is split into four features
Tokoname City is split into four features

If you dissolve this data by the municipality name field (N03_004), the map looks the same, but the four polygons named 常滑市 (Tokoname City) become one feature. The geometry still has several parts, but the attribute table treats it as one row.

Dissolving merged them into one polygon
Dissolving merged them into one polygon

By merging features that share the same name into one, you can analyze and aggregate data by unit, such as municipality or prefecture.

A feature made up of multiple geometries is called “multipart” or “multi-geometry.” Depending on the geometry type, it is further classified as “multipoint,” “multilinestring,” or “multipolygon.”

Dissolve an administrative area layer

This section walks through dissolving administrative boundary data.

Check the input layer

This example uses the administrative area data for Aichi Prefecture from National Land Numerical Information.

The attribute table shows 1,033 features, and the N03_004 field stores the municipality names.

The N03_004 field stores the municipality names
The N03_004 field stores the municipality names

Open Dissolve

From the menu bar, select Vector → Geoprocessing Tools → Dissolve.

Select Dissolve
Select Dissolve

The Dissolve dialog opens.

The Dissolve dialog opens
The Dissolve dialog opens

Run Dissolve

Now run the dissolve on the administrative area layer. The main settings are Input layer and Dissolve field(s).

Dissolve field(s) is optional. If you leave it empty, QGIS merges all features of the input layer into one. If you set it, QGIS merges features that have the same attribute value.

This time, set Input layer to the administrative area layer and Dissolve field(s) to the municipality name field (N03_004), then click the Run button. This dissolves the layer using the field that identifies municipalities.

Run the Dissolve tool
Run the Dissolve tool

Check the result

When the dissolve finishes, QGIS adds a layer named Dissolved to the project.

Because this example dissolves by municipality name, the map looks the same. In the attribute table, however, the feature count has dropped from more than 1,000 to 55, which shows that features with the same municipality name were merged into one.

Features with the same municipality name were merged into one
Features with the same municipality name were merged into one

Notes on dissolving

Suppose you create prefecture polygons from a municipal boundary layer. The attributes the data originally held at the municipality level, such as municipality name and municipality code, are combined at the prefecture level, so they lose their meaning as information about individual municipalities.

After dissolving, it is a good idea to clean up the attributes you no longer need.

Attribute information from before the dissolve loses its meaning
Attribute information from before the dissolve loses its meaning

Conclusion

Dissolve is one of the essential tools for organizing and aggregating data. It is useful in many situations, including restructuring administrative units, simplifying land use classes, and merging boundary lines, so learn how to use it and put it to work in your everyday analysis.

Data source

  • “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.