Aggregation — Operator family
Aggregation Operators summarise many values into one per zone or group: the values of one layer inside the zones of another, or of the features that share an attribute. For example the mean soil carbon per landscape, the area of each land use per landscape, the number of dwellings per district. The zones can be polygons (landscapes, districts, a grid) or the patches of a network. Dana Tomlin’s map algebra calls the raster versions zonal operators. What is aggregated decides the Operator: points or polygons, a continuous raster, a categorical raster, or a table grouped by an attribute.
Part of the Operators families. Used in: Aggregating a categorical raster to zones (Task), Aggregating a continuous raster to zones (Task), Habitat network (Task), Aggregating points to zones (Task).
Zonal statistics (continuous surface)
Operator Schema: for each zone, statistics of the raster cells inside it: count, sum, mean, median, minimum, maximum, standard deviation.
Choices to record: which statistic (mean and median differ when a few extreme cells pull the mean); how cells on the zone edge are counted (QGIS counts a cell when its centre is inside); cell size against zone size (a zone smaller than a few cells has an unreliable value).
Tools: QGIS Zonal statistics (Tool - QGIS) (polygon zones), or Zonal statistics by class (Tool - QGIS) (SemanticGIS plugin: the classes of a categorical raster as zones, with legend names in the table).
Tabulate area (categorical raster)
Operator Schema: for each zone, the number of cells (or the area, or the share) of each class of a categorical raster such as land use.
Choices to record: which classes to keep or group; area or percentage; how the zone’s total is defined (all cells, or only cells with a class).
Tools: QGIS Tabulate area (Tool - QGIS) (SemanticGIS plugin, with legend names as column names), or QGIS’s own Zonal histogram (column names are the raster values).
Summary by location (vector)
Operator Schema: for each zone, statistics of the features of another layer that fall inside it: count, sum, mean of a field.
Choices to record: the spatial relation and its direction (zones contain points); what to do with points on borders and with polygons that cross them. See Spatial relations.
Tools: QGIS Join attributes by location (summary) (Tool - QGIS) (counts, sums, means, medians in one run) and Count points in polygon (Tool - QGIS) (counts or sums only); Join attributes by location (Tool - QGIS) to give each point its zone instead.
Group-by statistics (by attribute)
Operator Schema: statistics of a field for each value of another field, without any geometry: the mean dwelling area per construction period, the number of patches per cluster.
Choices to record: which field groups; what to do with empty values in the grouping field.
Tools: QGIS Statistics by categories (Vector analysis), Aggregate (Vector geometry; also merges the geometries per group), or aggregate expressions in the Field calculator (Tool - QGIS).
Rule: never average averages upwards
Counts, sums and areas from small zones can be added up to a larger zone that contains them. Means, shares and medians cannot: average the cells again, or add up sums and counts and divide. See Modifiable areal unit problem.