7. Join attributes

In the last section we've created the wells_hydro_geology shapefile layer which is a copy of Shire groundwater monitoring wells, but then with the geology and hydrogeology attributes added. To add this layer to our GeoPackage we could drag the wells_hydro_geology shapefile in the Browser panel into the GeoPackage. However, then we would have two very similar layers.

In this section we're going to join the new attributes from the wells_hydro_geology layer to the Shire groundwater monitoring wells layer.

1. In the Layers panel click right on the Shire groundwater monitoring wells layer and choose Properties.

2. In the Layer Properties dialogue click the tab.

3. Click the Add new join button .

4. In the Add Vector Join dialogue choose wells_hydro_geology.shp as the Join layer. Choose No as the Join and Target field. Check the Joined Fields box and collapse the options there. Check the boxes of MaIHGComb and MaIGLG. We don't need a field prefix so we check the box Custom Field Name Prefix and delete the text.

5. Click OK.

The Layer Properties window will show a summary of the settings.

6. Click OK to close the dialogue.

7. Open the attribute table of the Shire groundwater monitoring wells layer to check the result.

Joined attribute table

The attributes have been joined. However, when we remove the wells_hydro_geology.shp layer, the join will be broken and the attributes will disappear. In order to prevent that we can copy the attributes with the field calculator.

8. Toggle on editing by clicking the button in the attribute table of the Shire groundwater monitoring wells layer.

9. Click to open the Field Calculator.

10. In the Field Calculator keep the box checked before Create a new field. Type Geology for the Output field name. Choose Text (string) for the Output field type. You don't need to change the Output field length. Expand Fields and values in the middle of the dialogue and double click MaIGLG to add it to the expression.

11. Click OK.

You'll see that the new Geology field has been added with a copy of the MaIGLG entrees.

12. Repeat steps 9 to 11 to copy the MaIHGComb field to a new field with the name Hydrogeology.

13. Toggle off editing by clicking and click Save.

This should be the result.

Shire wells attribute table with Geology and Hydrogeology fields

14. Close the attribute table.

15. Remove the wells_hydro_geology.shp layer from the Layers panel.

16. Check the attribute table of the Shire groundwater monitoring wells layer again.

You'll see now that the joined fields have been removed, while we still have the copied fields for Geology and Hydrogeology.

Attribute table after removing join

17. Save the project by clicking .

Now the GeoPackage of the project is ready.