You can use the Join attributes by location tool.
Say you have the following layers:
layer_a
: the layer to which you want to attach attribute values from layer_b
layer_b
: the layer from which you want to take attribute values
Go to Vector > Data Management Tools > Join Attributes by Location.
Then, set the parameters as below:
The tool will create a third layer (named layer_c
here) which will be layer_a
features combined to layer_b
attributes. You eventually have to remove columns that you don't need and the job is done!
Feel free to test Attribute Summary
and Output table
options depending on what you want to achieve.
If you are intersecting a lines or polygons layer with a polygons layer, the program might give you 'bad' results for overlapping features (i.e. a line intersecting 2 polygons or a polygon intersecting 2 polygons). In that case, the program will select attributes from the polygon that is intersected by the biggest part of the line / polygon.