ANINTRODUCTIONTOGIS


Joining data table to vector layer


This tutorial shows how to add a non-geographic data table (csv, xls…) to a vector layer.

The case study of this tutorial will aim at adding a winter soil cover data to the Puy-de-Dôme municipalities vector layer that we have already used in a previous tutorial.

The data we will use are from a dataset we produced to assess the adoption rate of winter cover crops in France. We will only work with a sample of this dataset for the municipalities of Puy-de-Dôme.


1. Add csv table to your project

The data is available in this repository. You may find: - The “COMMUNE” shapefile with the boundaries of the municipalities of the Puy-de-Dôme department; - A “cover_crop_63” csv file summarizing the ratio of agricultural area covered with winter cover crops before spring crops for each municipality.

To begin with, you can add the layer of the municipalities of Puy-de-Dôme to your project.

We will then add the csv file in the following way:

  • Layer > Add Layer > Add Delimited Text Layer
  • Select the corresponding file and click “No geometry (attribute only table)”

Figure 1 Add csv file


2. Join csv table to vector layer

We will now join the csv table to the vector layer. To do so:

  • Right click on the vector layer > Properties
  • In the “Properties” window select “Joins”
  • Select csv table in “Join layer” then select the right match between “Join field” and “Target field” (here the columns with the INSEE code for the municipalities in the csv layer and vector layer, respectively)

Figure 2 Join csv table to vector layer


Warning: You need to confirm you join with “Apply” before closing the “Properties” window.

3. Application

Practise: Make a choropleth map showing the percentage of cover crop adoption per municipality.