What if you have a vector polygon layer and you want to add a column to the attribute table with the size (area) of each individual polygon? Very simple in QGIS, just go to the vector menu: vector | Geometry tools | Export/Add geometry columns, which will give you the following input screen:
As you can see, you only need to add the path and name of the output shapefile and you are set. In the output file, two columns will be added to the original attribute table with the area and perimeter of each mapping unit / polygon. See for example the screenshot below with (1) the attribute table of the original layer and (2) the attribute table of the newly created layer with the two added columns with the area and perimeter. Note that the type of geometry will depend on the type of vectors you are working with. If you use line vectors, this tool will create a column with the length of the line elements.
Can’t get much simpler then that I would say. And see here for an example why you would want to create those columns to start with. Another example where you’ll need the size of the polygons is if you want to label the polygons in a vector map, but want to avoid labeling the very small once to avoid clutter. See this post by underdark how this can be done.
See my next post to see how to get geometry values using GRASS GIS. Using GRASS GIS for this is slightly more elaborated, but it also offers more options.