[GIS] How to copy the contents of an attribute from one vector layer to another one that touches it or intersects it

copyfields-attributesintersectionqgis

I have 2 layers that intersect, called layer A and layer B.

Layer A has an attribute (X) that I want to copy wholesale (for the whole layer) to layer B, so that when object A1 intersects object B1, attribute X1 from A1 is copied to B1.

I am trying to do this in QGIS. I used to do this in Mapinfo with an UPDATE query… then I switched to Mac. I am new to QGIS.

Best Answer

You need to use Join attributes by location from Processing Toolbox -> QGIS geoalgorithms -> Vector General tools -> Join attributes by location which allows you to copy the attribute of one of the two layers into the other using various Geometric Predicates including intersects and touches as you can see below:

enter image description here

If you want to transfer all records, even if they is no spatial connection, you need to choose Keep all records, otherwise you need to choose Only keep matching records located under Joined Table.

Related Question