[GIS] Cannot compute area of shapefile in field calculator of QGIS

areacoordinate systemfield-calculatorqgis

This shapefile represents the counties of NM. I am trying to compute the area of each polygon (yes, I know there is an area field, but this is a simpler example of a problem I'm having which doesn't have the areas).

  1. I load the shapefile into qgis and set the projection to UTM 13 NAD 83.
  2. I open the attribute table, enable editing, open the field calculator, select new field, real number, 20 digits, 4 digits precision, and set the expression to $area.

Of the 33 counties, all but 3 show an area of 0. The 3 with non-zero values have values that bear no relationship to the actual area.

I also tried reprojecting the shapefile to Conus Albers, open that in a project with the Conus Albers CRS, and get the same result. Obviously I'm doing something very wrong, but I'm not seeing it.

qgis 2.02 64 bit
Windows 7 Pro, 64 bit

Best Answer

You are doing nothing wrong: In QGIS Lisboa and 2.1.0 (dev) the areas calculate perfectly, in QGIS 2.01-3 (standalone) not.

This is a known QGIS 2.0.1 bug and has a ticket: https://hub.qgis.org/issues/9031

Simply turn off On-the-fly-reprojection while calculating the new field, or try again with the latest dev build from OSGEO4W.