7.6.6. Join attributes by location
In section 7.4.1. spatial queries were performed. In a similar manner, different layers and their features can also be spatially linked to each other, e.g. to relate thematic data to known coordinates or geometries:
- Go to Vector.
- Select Data Management Tools.
- Choose Join attributes by location.
- Select a target (e.g. bee_colony_locations.shp) and a join vector layer (where the attributes are taken from, e.g. commune_boundary_FR.shp).
- Choose how the attributes should be attached to the target layer (by the first matching feature is usually the best choice if text fields are joined, but in the case of numerical attributes different aggregation modes may also be suitable).
- Set the path and name for the destination shapefile (Fig. 100).
- Click OK
- Load the new shapefile into the project by clicking Layer > Add Vector Layer.
Within the Attribute table of
the new shapefile, the attributes of the commune layer will be added.
Fig. 100. Attributes of a given layer can be attached to another by the use of a spatial join.