By David Crowther
How can you group individual records into Multi-Part objects within QGIS?
The Aggregate Tool within QGIS enables you to group individual records by a column value, to create a record with Multi-Part Objects.
In QGIS below I have a Polygon Layer showing Planning Applications. These each have a Progress value, of either – Passed, Submitted or Failed.
We will use the Progress value to group the individual records into 3 Multi-Part object records.
From the Processing menu choose > Toolbox > and open the Vector Geometry section.
Choose the Aggregate menu option.
The Aggregate Tool will open.
We will use the following settings:
- In the Input Layer choose the Planning Apps Layer.
- In the Group by Expression choose the field to Group on > Progress
- For each field in the Input Layer, you should choose what will happen when those values are aggregated e.g.
- SUM the values for numerical fields e.g. the Area field.
- Concatenate Textual input fields.
- or use the First value for textual fields e.g. the Progress field.
- Finally choose the output file, this could be a GIS file or a Temporary Layer that you can save a copy of later.
If you now Run the Aggregate Tool, data dependent, you may encounter some possible errors. For example, if you have invalid geometry, the tool will notify you and you will need to either amend those records or you could ignore them.
To ignore invalid geometry, you can choose the Settings button.
and then choose the Skip (Ignore) option for Invalid feature filtering.
Once the tool successfully runs, a new Temporary Aggregate Layer is created.
It will now have grouped the individual records from the input layer (Planning Apps) by the chosen field (Progress). So, in the results table we now have just 3 Unique records – Passed, Submitted and Failed Planning Apps, and if we were to select one record, we now have Multi-Part Geometry connected to that record.