4

I had various layers and through geoprocessing tools "Clip" and "Difference" I have created one layer in QGIS 2.16. This layer has 98 attributes - polygons. I want to calculate the area of each of the polygons and only retain those that are larger than 10ha:

Open Attribute table -> toggle edit -> Add field -> Name = "Area" (real).

Field Calculator -> enter image description here

I do obtain the calculated area for the first 38 polygons, but not for the remaining ones. I tried to locate the ones without calculated area and obtain this error:

enter image description here

What does this error mean?

Is it even possible to calculate the area for the remaining ones? If so, How?

  • Check the geometry validity of those polygons to see if there is any topological error. – ahmadhanb Oct 31 '17 at 10:53
  • The problem is that i cannot identify the polygons with geometry Null...or at least i do not know how. Is there a tool? – user1607 Oct 31 '17 at 10:54
  • 3
    'Geometry is NULL' means that those features have no geometry, maybe try running the tool again. You can't identify them because there is nothing to identify ( they have no geometry ) – Hasan Mustafa Oct 31 '17 at 10:55
  • 1
    To be sure, go to Vector -> Geometry tools -> Check Geometries from there you can check the validity. I suspect you do not have any geometry if it is NULL – ahmadhanb Oct 31 '17 at 10:57
  • 1
    Another thing that you need to update your QGIS to the latest release. It is now 2.14.20 for LTR and 2.18.14 for latest release. – ahmadhanb Oct 31 '17 at 10:59
4

Clip and Difference tools are meant to work for situations like below:

enter image description here

It is natural for these tools to retain original attribute table (of Layer1) as-is.

However, we tend to abuse tools by doing something like below:

enter image description here

Original attribute table of Layer1 is kept, but geometries were lost (erased by us, actually) through the operation.

It is "no problem" using the tool like second example, but we need to keep in mind the attribute table is untouched. Just open the attribute table, select records with $area>0, and save them as a new layer.

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.