I'm using QGIS 2.4.0 and I've noticed some problems with the derived area and the $area field. Firstly, I have a polygon which is a filled ring, inside another polygon. The derived area, and therefore my $area field, is saying 600sqm, but the actual measurement made with the area measure tool, is 300sqm. Why the discrepancy?

Also, why am I having to re-write the area field every time I make any changes to the vector layer. It's a real pain as I'm having to present areas in Hecatre so the formula involve both conversion and rounding. To have to re-write it each time I make any adjustment is really slowing me down. Any plugins that might have an auto-updating area field?


Yes, there is a plugin called AutoFields (that I developed) for configuring auto-updating fields. You can set an expression (e.g., $area) for the field, look at the documentation.

Watch this video for a related example.

Note: As you have already acknowledged that you haven't replicated the 1st part of you question, I won't add any comment to it.


The simple answer might be that changes to your polygon layer will not be confirmed until you save our edits. Make sure you save your edits between creating your ring and doing your area calculation.

I believe it is possible to create automatically updating area fields in QGIS 2.4, but I haven't been able to do it myself as it requires a bit of Python.

In QGIS 2.6 you can create a virtual field which allows you to create a field that automatically updates (and can include a formula). This sounds like it would do exactly what you want it to do. Upgrade to QGIS 2.6 and you will see the ability to create a virtual field in the field calculator. The virtual field definition is kept in the project or layer definition file, rather than within the shapefile itself, but to all intents and purposes you can use it like you would any other field.

  • I've just saved all edits and the problem persists. The polygon I'm measuring is listed in the attributes table. In my area field (which contains the formula $area/10000) the area is listed as 0.06. My labels for this layer are created by the same expression ($area/10000) and they report an area of 0.026..... Using the measure area tool the area is indeed 260 sq m, which would concur with the label. Why then is my area field giving me double the result? – Isaacson Nov 19 '14 at 9:55
  • I've went through the steps here and that is a very odd. I'm assuming you are only using one coordinate reference system. – Neil Benny Nov 19 '14 at 10:31
  • I've noticed that you need to save the edits before the virtual field will recalculate. – Neil Benny Nov 19 '14 at 10:31
  • You also need to close the attribute table and reopen it before the recalculation will show up. Any joy with this? – Neil Benny Nov 19 '14 at 10:31
  • Thanks all, QGIS 2.6 does seem to have answered the auto-updating field question. In answer to the other issue, I am using two different CRS, but with OTF re-projection on, so it shouldn't make a difference. Unfortunately, as this was a project for work, I had to move on and have just re-drawn the map. I've since been unable to replicate the problem. It may have to remain a mystery. – Isaacson Nov 22 '14 at 7:26

I've found similar issues when adding polygons and updating an area field with ($area/10000). It uses a different method than (area($geometry)) and often returns a different answer. I've concluded that editing, saving edits, turn editing off, open table/recalc field with (area($geometry)) works consistently. I don't mind discrepancies and errors, as I often actively look for them, if they are noticeable, and I can find a method that avoids the errors consistently. This method works for me. I haven't used the auto-calc field feature or virtual fields yet, but I thanks for bringing it up because I probably will move towards using it.

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.