6

The area of the polygons in a layer, calculated by the field calculator with "$area" is wrong (much too big) for some polygons. If I draw the concerned polygon again, the area is calculated correctly. It looks like the polygons really have a wrong size, but the centroids are calculated correctly.

edit: Thanks for your replies so far. Here is an example with some polygons. For some, the area is calculated right, for some not (as I said much too big). For example the polygon with the ID 669. If I redraw it, the area is calculated right. The problem is, I have >1400 polygons, and I don't have the time to check and redraw every single one.

Maybe someone got an explanation/solution?

3
  • Can you provide data which exhibits the problem? If so, this would be worth a bug report. Also, I fail to see the question in your post. – underdark Sep 5 '14 at 16:54
  • 2
    Is it possible you have multipolygons, and the $area is returning the total area of all constituent pieces? – Darren Cope Sep 5 '14 at 17:10
  • 1
    Hi @DarrenCope, your solution was correct. Please post it as an answer :) – Joseph Oct 20 '14 at 11:02
3

@DarrenCope made a very good point, your layer contained inconsistencies.

Please note: I only posted this as an answer as to include a screenshot of the results, please accept Darren's answer when he posts one as he came up with the correct solution.

I used the Multiparts to singleparts function (via Vector > Geometry Tools > Multiparts to singleparts) and then re-calculated the area in a new column with Real numbers and precision of 2:

Area results

Ironically, enabling the "on-the-fly" option for CRS gave the correct results as it often provides wrong values. The CRS I used was: EPSG:4326 - WGS 84.

3

You may have multi-part polygons in your file, and the area column would thus be reflecting the total area of all 'parts' of a polygon. You can use the Vector > Geometry Tools > Multiparts to singleparts tool to create single-part polygons, and calculate the $area on those to get the answer you are expecting.

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.