1

I have two polygon files (A being my area of interest and B being a categorised land cover layer). Both layers were in the same projection (projected and not geographic). Using QGIS 2.0, I used the Intersect tool (Vector > Geoprocessing tools > Intersect) to extract and pair the information from my land cover layer (layer B) to my area of interest (layer A).

I then opened the attribute table for my newly created layer and enabled editing. A new column was made (using a decimal field type) and I then used the Field Calculator to calculate the area for each of my table rows. The "preview output" at the bottom of the Field calculator showed a realistic number. However, when I clicked ok the resulting output was generally nonsensical with illogical values produced. I then toggled editing and saved the values.

Then using the Group Stats plugin, I used my intersected layer but used the plugin to calculate the area of my intersected attributes and it produced the correct answer.

Apologies for the long-winded description but can someone tell me why the area calculation using the Field Calculator failed to produce the correct answers? As I said, both layers were projected and matched the projection projection so I don't see this being a projection issue.

3
  • Can you please post examples of both the Field calc output and the Group Stats plugin? the answer may lie in the formatting of the values.
    – bjmarra
    Dec 5, 2013 at 23:13
  • Thanks - apologies for the delay. As an example. In Field calc, I get an area of -2641416.088 using "$area" but under Group Stats, I get 208876 for the same category. Not all of the results under the Field Calc output are negative but all are incorrect. Does this help?
    – gyrovague
    Dec 9, 2013 at 15:09
  • Again, under the Preview of Field Calc, it suggests that I'm going to get the right answer until I click ok and then I get the nonsensical values
    – gyrovague
    Dec 9, 2013 at 15:13

1 Answer 1

1

Not sure if this will help, but there may be a connection...

http://osgeo-org.1560.x6.nabble.com/Field-calculator-issue-td5091278.html

1
  • That is interesting - so if I switch off the OTFP then the area calculation works and I get the correct output. Do you know if this will be the final solution?
    – gyrovague
    Dec 9, 2013 at 15:16

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.