Adding geometry columns to attribute table of vector map

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.


6 thoughts on “Adding geometry columns to attribute table of vector map

  1. Nice idea labeling polys conditional on area – I like it. Enjoying learning more about qgis.. I’ll be very happy to leave ESRI behind one day. Not that I don’t like using it, but it’s the only reason I need to dual boot Windows.

    1. pvanb

      I occassionally use Windows (on virtual box), but not for ArcGIS. I left that behind some time ago at a time I couldn’t afford it. Now I can get a copy through the university, but I really don’t need it anymore; QGIS, GRASS GIS and R cover all my needs.

  2. Pingback: Add geometry values to vector layer in GRASS GIS | Ecostudies

  3. Johnk686

    Magnificent site. Plenty of useful information here. I’m sending it to some friends ans additionally sharing in delicious. And certainly, thanks in your sweat! ceaggeebfcee

  4. Sravanthi


    Can you explain what is the unit the area is being measured in? I am getting something to the effect of 0.000007 and the polygon size i am trying is measure is roughly 9.02 ha

    Thanks in advance

    1. I assume the mapping units of your layer? If your map is in latlon and you are at the equator, one degree is approximately 110574 meter. So if we assume your area is squarey, each side would be 293 meter long (sqrt(0.000007)× 110574), or approximately 8.6 hectares (293^2)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s