ANINTRODUCTIONTOGIS


Getting started with vectors processing


This tutorial shows the basics of vector manipulation with QGIS.

The files used here are from the BD TOPO from the French National Geographic Institute (IGN). This database provides a vectorial description, structured in objects, of the elements of the French territory and infrastructure, with a metric precision.

More precisely, we will use the BD TOPO 63, which contains these elements for the Puy de Dôme department.


I. Filter a vector layer

To simplify, the main vector layers for this tutorial are available here.

First, open QGIS and set the system of coordinates of your project as Lambert 93 (EPSG:2154), which is the reference coordinate system for France:

  • Project > Properties > CRS

Then, the first layer we will add is that of the municipalities of the Puy-de-Dôme.

  • Layer > Add layer > Add vector layer
Figure 1 Add vector layer


On the layer menu, on the left, you may open the table of attribute of this vector layer:

  • Right click on the name of the layer > Open Attribute Table

In this table, you can access different information about each of the municipalities. Each row is a different entity (here a different municipality).

If we look at the “INSEE_DEP” column specifying the department number, we can see that not all municipalities are located in the Puy-de-Dôme (department number: 63). We will thus filter the table to keep only the municipalities inside the department.

To do so:

  • Click on the “Select features using an expression” button, on top of the attribute table
  • In the new window:
    • Below “Fields and Values” select the column of interest (here “INSEE_DEP”)
    • Complete the formula to specify that you want to keep only entities with a value of ‘63’ for this column
    • Click “Select Features” to perform the selection
Figure 2 Filter vector layer


Back on the attribute table, we now see that the selected entities are highlighted. We can also locate the selected entities on the map.

We may also create a new layer with only selected entities like that:

  • Right click on the name of the layer
  • Export > Save Feature as
  • Choose the following options:
Figure 3 Save filtered layer


II. First choropleth map

We are now ready to make a first choropleth map of the Puy-de-Dôme population. To do so:

  • Right click on the name of the filtered layer
  • Select “Properties”
  • In the new window, open the “Symbology” tab
  • Select “Graduated”, with value “POPULATION” then click “Classify”
Figure 4 Make choropleth map


Practise: Change color palette. Change mode for the creation of intervals (from “Equal count” to “Equal intervals”). Manually change the limits of the intervals.


III. New fields in attribute table

One of the weak points of choropleths is that the largest entity can appear as the one with the highest values only because of its size.

To correct this effect for our map, we will convert the population map already created into a density map. To do this, we could directly use the column “SURFACE_HA” which is present in the attribute table. But to check this data we will start by doing our own calculation of the area per entity:

  • Open the attribute table of the vector layer
  • In the top bar, select the icon “Open field calculator”
  • Fill the new window as follows:
    • Check “Create a new field” and specify new column name
    • Verify that the new field class is “integer”
    • Write formula to compute area and divide by 10 000 to convert square meters to hectares
    • Click “OK” to create new field


Figure 5 Calculate area per entity


The ‘Field Calculator’ will automatically turn on the edit mode. To save the changes, you will need to turn off this mode (pencil icon, topleft of the window).

In a similar way we can now create a column to calculate the difference between the two fields (ie. given area and calculated area).


Figure 6 Calculate difference between the two columns


Practise: Create a new field with population density. Make a map of the population density of the Puy-de-Dôme.