Working with attribute data

From TOI-Pedia


Vector datasets consist of points, lines or polygons representing the shape and location of each geographic feature. In addition, they also consist of attributes, which are used to describe the properties of each feature. This tutorial will explain the basics of viewing attribute data in QGIS and show you how to create your own attributes.


In this tutorial, we will use data from the BAG (Basisregistratie Adressen en Gebouwen) as an example of how to work with vector attribute data in different ways using QGIS. If you would like to obtain the same data, you can follow this tutorial.

Building footprints of TU Delft from the BAG dataset

Identify results

The identify results tool shows the attributes of the feature(s) you click on

The simplest way that you can view a feature's attributes is by using the "identify results" tool. This can be found in the vector toolbar, which is usually automatically displayed in the top section of the QGIS interface. With this tool, you can simply click on one of the features in your dataset and a window will pop up to list the feature's attributes.

For example, in the screenshot to the right, the tool was used to select the polygon representing the TU library. You can see that this feature was selected because it is highlighted in red. The pop-up window shows the attributes associated with this polygon. For instance, the building year (bouwjaar) is 1994, the status is building in use (pand in gebruik) and the function (gebruiksdoel) is education.

Identify results

Opening the attribute table

The attribute table

If you want to view the attributes of all features in a dataset, you can open the attribute table. In order to do this, select the layer in the layers list to make it the active layer and then click on the "open attribute table" icon in the top section of the QGIS interface. This will open a table as a pop-up window. Each feature in the dataset is shown as a row in the table and each attribute as a column.

Open attribute table

Selecting features

Selected features are highlighted in yellow
Selected features are highlighted in blue in the attribute table

To select features, you can use the "select features by area or single click" tool. Simply click on a feature to select it or click and drag to select all features within a rectangular area. Features that have been selected will be highlighted in yellow. You can see how many features have been selected at the bottom left of the QGIS interface. Deselect features by clicking somewhere else on the map canvas or clicking the "deselect features" icon.

It is useful to be able to select specific features for many reasons. One is that it makes it easier to find those features in the attribute table. Selected features are highlighted in blue in the attribute table. You can make selected features show up in the first rows of the table by clicking the "move selection to top" icon.

Select features
De-select features

Creating a new attribute

Field calculator window
New field added to attribute table

In order to create a new attribute, click on the "open field calculator" icon. You can access this at the top section of the QGIS interface, but also in the attribute table. Follow these steps:

Step 1: Fill in a name for the attribute you want to add.

Step 2: Choose an appropriate output field type. For instance, if the value of the attribute you are adding is a number that will have decimal places, choose "decimal number (real)" from the drop-down menu.

Step 3: Type an expression in the empty box.

  • You can use the menu to the right to select different functions to construct your expression with.
  • A useful function is $area, which can be used to calculate the area of each polygon.
  • If your expression is successful you will see an output preview.

Step 4: Click OK and the attribute will be added to your dataset.

Step 5: Adding a new attribute will turn the layer into editing mode. Switch off editing mode by clicking the yellow pencil icon in the toolbar and save the changes you have made.

You will be able to find the attribute that you have added in the last column of the attribute table.

Open field calculator
Turn edit mode on / off

Useful links

Personal tools