[GIS] Field calculator not calculating all feature areas: Geometry is NULL

areafield-calculatorgeometryqgis

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?

Best Answer

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.

Related Question