I have a layer with several polygons making up a division together. They all have attributes with population.
Is it possible to add up the population in a merge so I don't have to use a calculator every time the data is updated?
An easy way to add or sum numbers is using sql in a virtual layer in QGIS.
Sum all numbers in mycolumn:
select sum(mycolumn) from mytable
Sum all numbers in mycolumn1 based on another column:
select sum(mycolumn1), mycolumn2 from mytable group by mycolumn2
You can also create a new geometry based off a value from another column:
select sum(mycolumn1), mycolumn2, st_union(geometry) as geometry from mytable group by mycolumn2
You can find the Virtual Layer editor in the Data Source Manager.
Virtual Layer approach, but currently having a trouble using it in QGIS 3.0-3.2 for some unknown reasons. Just in case you also have issue with Virtual Layer, I would suggest Aggregate function.
You can find it in
Processing Toolbox | Vector geometry | Aggregate.
valfield) into the
Type(as your data is population)
Please note the output geometries are multi-part objects.