Attribute Joins
-Let’s say you have data for the street network in different vector files. One file is peru_highway, which contains the name, type, number of lanes and direction of the streets. The other file is peru_street_length, which has information on the length of the streets.
-peru_highway:
-peru_street_length:
-The task is – how to join the two tables in one? First, add both layers in QGIS from the Vector folder, where you downloaded the files for this practical.
-Now we will join the two layers. Double-click on the peru_highway layer to open Properties dialog. Go to the ‘Joins’ tab.
-Click on the ‘+’ to create a new join. Select peru_street_length as a join layer. The ‘Join field’ will be the unique identifier from the peru_street_length data- select ID. The target field will be the unique identifier from the peru_highway layer- select ID. Click OK. Once the join is created, click OK and return to the QGIS canvas.
-Now right-click on peru_highway to see its attribute table:
-You will notice that the table now contains additional fields taken from the street length file.
-Remember that this join is temporary. It is not part of the attribute table for the peru_highway layer, but just linked dynamically to the peru_street_length layer. If you want to permanently join the attributes, you must save it as a new layer. Right click on the peru_highway layer, select “Save As”. Name the new layer peru_highway_length.shp