Sunday, 22 May 2016

Calculating the average / MEAN of an attribute field in a QGIS model


I need to know how to calculate the average / mean of an attribute field in my point shape file. Is this possible to do with the field calculator? I just found the options min or max but not mean. The result should be written in a new attribute field for further data processing. I would like to do this within a model.



Answer



This is a pretty late answer but you can do this in the Model Builder, a simple example is shown below:


Processing modeler


With your vector point layer already added, you can access the Field Calculator:


Field Calculator



In the Formula textbox, you can add your little equation to calculate the percentage. Depending on the column names of the attributes, you can use something like this:


("Altitude_Column" / Some_Total_Value) * 100

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...