5

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

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
2

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.

  • But I wanted to do with the modeler. – Pimpel Jun 5 '14 at 14:28
  • 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 W Jun 5 '14 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). – Pimpel Jun 5 '14 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 W Jun 6 '14 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.