### Aggregation

This operation aggregates objects of a layer based on specified attributes. Objects with the same value for the specified attributes will be part of the same group. The output is a new layer that contains an object for each group identified in the input layer. The geometry of the group is the result of the spatial UNION of the geometries of the objects that where aggregated in that group. The attribute that was used to generate the groups and the number of objects that where aggregated are automatically generated as attributes of the group.

Optionally, the attributes of the aggregated objects in a group can be summarized using statistical values and saved as attributes of the group. The following statistical summaries can be selected:

- for numerical properties: MINIMUN VALUE, MAXIMUM VALUE, MEAN, SUM, TOTAL NUMBER OF VALUES, TOTAL NUMBER OF NOT NULL VALUES, STANDARD DEVIATION, VARIANCE, SKEWNESS, KURTOSIS, AMPLITUDE, MEDIAN, COEFFICIENT OF VARIATION and MODE;
- for text properties: MINIMUN VALUE (lexicographical), MAXIMUM VALUE (lexicographical), TOTAL NUMBER OF VALUES and TOTAL NUMBER OF NOT NULL VALUES

### Interface usage

Go to Vector Processing > Aggregation... to obtain the following interface:

1. Select the layer with the objects that will be aggregated.
2. Select one or more attributes that will be used to group the objects of the layer.
3. Check the option "Calculate Statistics" if you wish to calculate a statistical summarization of aggregated objects attributes.
4. In this case, select the statistical summarization and the attributes.
5. Select a layer name and a repository (data source) to store the operation result.
6. Click "OK" to perform the operation or "Cancel" to close the interface.

The image bellow shows an example of the interface filled with some parameters.

### Usage tips

The Aggregation result can be stored in different TerraLib datasources. Check data source selector for more details on how to select a data source.

The request for summarization statistics generates attributes for the groups. Its names are the input attribute name combined with the statistic parameter name. For example, suppose that the input data has an attribute called "population" that will be summarized by the parameter sum. The attribute of the group will be called "population_SUM". The output datasource is responsible for validating the groups attribute names, if they are not acceptable they might be modified. For example, in DBFs (part of Esri Shapefiles) attribute names can not be more than 10 characters long.

The option to use only selected objects from the Input layer is under development.