ANINTRODUCTIONTOGIS


How to map country statistical data


This tutorial shows an example of workflow to map statistical agricultural data with QGIS. To do this, we will use a background map from the Natural Earth website and agricultural data downloaded from FAOStat. The join between the map and the data, as well as the layout of the map, will be performed with QGIS.


1. Download background map

We will start by downloading a world map. On the Natural Earth site, in the “Downloads” tab, click on the “Cultural” button for Medium scale data

Figure 1 How to find country boundaries shapefile



On the next page, click on “Download countries” button, in the first section (Admin 0 - Countries)

Figure 2 Download countries map



After unzipping the downloaded folder, you can open QGIS and add the world map as follows:

  • Layer > Add layer > Add vector layer
Figure 3 Add vector layer



If you want to map a particular region of the world, it is recommended to change the coordinate system to the most suitable one. For example, the CRS code for Europe is EPSG:3035. You may select this CRS in the “Project” tab:

  • Project > Properties > CRS


Before you continue, open the attribute table (right-click on the layer name, then “Open Attribute Table”). This table contains various data concerning the entities represented on the map. The column that will allow us to join the statistical data is ISO_A3_EH. In this column, each country is identified by a unique three-letter code.

2. Download country statistical data

Agricultural data can be downloaded from the FAOStat website. A wide range of data is available on this site, and you can choose the ones that interest you. Before starting the download, it is necessary to change the country identifier to the ISO3 code, in order to be able to perform the table join with the map later on.

Figure 4 Download statistical data



The downloaded file is not a spatial file, but a data table. It is added to QGIS as follows:

  • Layer > Add Layer > Add Delimited Text Layer
  • Select the corresponding file
  • Select the right format (here csv)
  • Click “No geometry (attribute only table)”
  • Then add file
Figure 5 Add csv to QGIS



3. Join csv table to vector layer

We will now join the csv table (statistical data) to the vector layer (world map). To do so:

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

Figure 6 Join csv table to vector layer


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

You can now display your data downloaded from FAOStat on the world map. More information on how to create a choropleth map is available in this tutorial and the final layout of the map is detailed here.