I'm trying to calculate the area of polygons using the field-calculator in QGIS (2.0.1). If I do this manualy it works fine, but if I do this using the graphical-modeler I get NULL as area for every Polygon. I just typet $area in the Formula field. Field-type is integer and length is 10.


2 Answers 2


The Field Calculator is not working within the modeller, but the Advanced Python Field Calculator is doing the job: value = $geom.area()


It is possible to use the Field Calculator within the Graphical Modeler, if one makes use of the input vector field. Consider a vector layer, that is the output of a dissolve and multipart to singleparts operation, resulting in wrong values of Shape_Area:

input vector layer table view

Here, it is called Layer_for_calculating_area, and the field to be recalculated is Shape_Area.

1. Define an input for the vector layer: 2. Define an input for the vector field:
input vector layer input vector field
  1. In the algorithm window for Field Calculator, choose “using model input” for both input layer and field name, and don't forget to set the desired output field length and the precision. Formula: $area (see the QGIS documentation

algorithm field calculator

  1. After hitting the button run model (or key F5), Button run model

make sure that the dropdown lists show the correct inputs, respectively.

graphical model

After the model has created the output layer, a manual measurement shows that the values of the field Shape_Area are now correct:

test manual measurement

  • Hej! Thank you SO SO SO much, I just missed a part in your step 4! where is the button run model, where do you find the parameters?
    – Robagb
    Feb 4, 2022 at 10:52
  • Glad that the answer is helpful for you. I edited the step 4 to make it clear.
    – ebcs
    Feb 5, 2022 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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