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.
2 Answers
You could get statistics on that field (Vector > Analysis Tools > Basic statistics) which will tell you the mean, and then create a new attribute and use Field Calculator to fill every record with that value.
-
-
Can you clarify what you mean by modeler? I'm familiar with ModelBuilder in ArcGIS, but the only QGIS equivalent I see right off is Sextante, and I don't know much about it. A Field Calculator works with individual records. By itself, it can't do a calculation involving all records like mean of a column. The min/max functions you found would compare fields in a record, not one field of all records.– Chris WCommented Jun 5, 2014 at 18:00
-
Yes I'm using the sextante (now its called processing) model builder. I have a column with altiude values (70-132 m). I want to get a column with the relative values (percentaged).– PimpelCommented Jun 5, 2014 at 21:07
-
@Pimpel Unfortunately I don't know enough about the QGIs modeler to work this one out just yet. I have edited your question to hopefully bring it to the attention of someone who may.– Chris WCommented Jun 6, 2014 at 7:39
This is a pretty late answer but you can do this in the Model Builder, a simple example is shown below:
With your vector point layer already added, you can access the 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