Introduction
When working with geospatial data, a common challenge arises when spatial information and attribute data are stored in separate files. This often occurs due to different data collection methods, storage formats, or processing workflows.
If not addressed, this separation can create difficulties in analysis, visualization, and decision-making. For example, a dataset of farm plots may contain only geometric information (polygons), while the associated attributes, such as crop type or ownership, are stored in a separate CSV file. Without combining these datasets, conducting meaningful spatial analysis or generating reports becomes cumbersome.
To solve this issue, we can join attribute data to geospatial data in QGIS, an open-source GIS tool. This process integrates attributes into a single dataset, ensuring all relevant information is accessible in one place.
This tutorial assumes QGIS is already installed on your machine. If not, follow the QGIS installation guide.
The tutorial is created on a MacOS machine, but the steps should be the same for other operating systems.
Observe the Data
Before performing the join operation, we first examine the datasets. In this case, we have a shapefile for the geometry data and CSV file for the attribute data.
Open the Shapefile data in QGIS. The shapefile contains farm plot geometries. To inspect its attributes:
Right-click the layer
Select Open Attribute Table.
Identify the Farm ID column. This unique identifier will be used to join attributes from the CSV file.
Now, open the CSV data. The CSV file contains attribute data for the farm plots. To observe its contents, open the CSV file using a text editor, spreadsheet software, or directly in QGIS.
Identify the Farm ID column, which should match the one in the shapefile. Verify that the additional attribute columns contain relevant data (e.g., crop type, owner name).
Join Attributes to Geospatial Data
Now that we have verified the matching Farm ID fields in both datasets, we can proceed with the join operation.
Drag and drop the CSV file into the Layers panel in QGIS.
Afterward, we start the join operation.
In the Layers panel, double-click the farm plot shapefile to open its Layer Properties window.
Navigate to the Joins section.
Click the green Add Join (+) button to open the Add Vector Join window.
Join Layer: Select the CSV file containing the attribute data.
Join Field: Choose the Farm ID column in the CSV file.
Target Field: Choose the Farm ID column in the shapefile.
Joined Fields: Select specific columns to include in the join.
Custom Prefix: Enter a prefix (e.g. underscore _ ) to distinguish joined attributes in the shapefile’s attribute table.
Click OK to apply the join.
Verify the Join by opening the farm plot shapefile's Attribute Table. Check if the new attribute columns (with the chosen prefix) have been successfully added.
Export the Joined Data
To retain the joined attributes permanently, export the dataset as a new file:
In the Layers panel, right-click the farm plot shapefile.
Select Export
Select Save Features As….
In the Format dropdown, choose ESRI Shapefile (.shp).
Specify the output file name and location.
Click OK to save the file.
Conclusion
Joining attribute data to geospatial data is essential for performing spatial analysis, improving data integrity, and simplifying workflows. By following this tutorial, you have successfully combined separate datasets into a single, enriched dataset in QGIS.
This process can be applied to various geospatial tasks, such as land-use mapping, infrastructure planning, and environmental analysis. Experiment with different datasets to become more familiar with QGIS’s powerful data management tools.









