How to do table join in QGIS ?

Join or a table join is a kind of spatial analysis that appends all the columns from one table into the other table based on the unique ID. A join is usually used to attach more attributes to the attribute table of a geographic layer.

Performing join in QGIS is simple and very easy. For this tutorial I’m going to use the region shapefile of Singapore and a hypothetical csv data showing rainfall and Ph values.

 It involves mainly two steps of loading csv data and the join itself. The major steps involved are:

Loading csv data

Step 1: Load csv data

A new interface would be open something like below.

Click that three dot icon to choose desired csv file and choose no geometry under geometry definition section.

Step 2: Changing default field type

Now we need to change the default field type according to csv data field value type as shown below.

Choose data type integer 64 bit for id, decimal (double) for Ph, Rainfall & Temp-Celcius and finally text string for Region.

Now your data has been loaded successfully as shown below; you can open its attribute table and see the existing data.

JOIN

Step 1: Open attribute table of both data and see whether common field values are present or not like below.

Since Region (from climate data) and Singapore region boundaries have common field value we are ready to go for join.

Step 2: Double left click Singapore shapefile -> Join -> Click (+) green sign to add a new join and follow rest of the images.

A new interface will be opened something like this.

Choose the csv layer with whom you want to join shapefile in Join layer as ‘Climate-data’, Join field as ‘Region’ and Target field as ‘region_c’.

Remember we need to use common attributes of two data layer which are ‘region_c’ of shapefile layer and ‘Region’ of csv layer.

Also tick join fields and fields that you want in join layer.

Now you will see a new joined layer in join tab.

Now open attribute table of Singapore region shp and your data has been joined successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *