Spatial Join in QGIS – Quantum GIS an open source software. Spatial join is used for joining or transferring attributes of two vector layer based on their spatial relationship. In QGIS we can perform this task using Join Attribute by Location tool.
Here we have a university spatial data where, there are 21 teaching departments in this university. Each department runs a number of courses. The no. Of courses of each department is given. We want to find out total no. Of courses run by the university. We can find this by simply adding all the numbers, but here we will see how to use Join attribute by location tool.
More QGIS tutorial can be found here.
Spatial Join in QGIS – Steps
1.) Open Join attribute by location tool.
If these tools are not enabling by default you can enable these tool by going into plugin manager, as shown below in image.
2.) Set the Dialog box as follows: Target vector layer is the layer to which we want to add the attribute. The join vector layer is the layer from which we are transferring the attributes. Click on take summary of intersecting features because we want all features covered by the location and we want to keep all the records as there are no matching records. Click OK.
3.) A new layer is added to the table of contents. Open the attribute table of new layer. where you will get the Count Column as total number of University department, which was our desired result.
4.) Here we have got some unwanted fields also. As we only want SUM of courses as a field, so we will delete the other fields. We can delete column only in editing mode. So click on toggle editing tool and click on delete column. Select the column which you want to delete and then click ok. Click save edits, and again click on toggle editing tool.
For exploring more editing tool, you may follow this aritcle: Digitization in QGIS – Exploring tools for Digitizing.
You may also explore other QGIS tutorials: