5. Calculate the borehole density

Now we have the boreholes within a study area (this could also be an aquifer) we can calculate the borehole density.

1. Open the Processing Toolbox: in the main menu go to Processing | Toolbox.

2. In the Processing Toolbox choose Vector analysis | Count points in polygon.

3. In the Count Points in Polygon dialogue choose Stampriet_boundary as Polygons and boreholes_clipped as Points. Change the Count field name to No of boreholes. Save the Count output to the Stampriet_Data GeoPackage with the layer name Stampriet study area.

We're using that output name, because this tool makes a copy of the Stampriet_boundary polygon and adds the No of boreholes field. We didn't have the study area boundary yet in our GeoPackage, so now we'll add it in this way.

4. Click Run. Click Close after processing.

Note that if your input has multiple polygons (e.g. different aquifers) it will produce the count per polygon. You can apply the next steps then to calculate the borehole density for all polygons.

5. Copy the style of Stampriet_boundary to Stampriet study area: in the Layers panel click right on Stampriet_boundary and choose Styles | Copy Style | All Style Categories. Then click right on Stampriet study area and choose Styles | Paste Style | All Style Categories.

6. Remove the Stampriet_boundary from the Layers panel.

Now let's have a look at the Stampriet study area attribute table.

7. In the Layers panel click right on Stampriet study area and choose Open Attribute Table.

You can see that we have 64 boreholes in the study area.

Now we need to calculate the area of the study area polygon.

8. In the attribute table click the button to toggle editing on.

9. Click to open the Field calculator.

10. In the Field Calculator dialogue Create a new field with the Output field name Area (km2) and Output field type Decimal number (real).

11. Under Expression choose from the functions in the middle panel Geometry | $area and double click on $area to add it to the expression. $area  calculates the area of the polygon in map units. In our case that's m2. Complete the expression so it states:
$area / 1000000

Use the button to add the division.

12. Click OK.

The result should look like the figure below.

The next step is to calculate the borehole density.

13. Click to open the Field calculator.

14. In the Field Calculator dialogue Create a new field with the Output field name Borehole density per km2 and Output field type Decimal number (real). Under Expression with the following equation:

 "No of boreholes"  /  "Area (km2)"

Remember you can add the fields by double clicking the field names under Fields and values in the middle panel. Use the button to add the division.

15. Click OK.

16. Toggle off editing by clicking and click Save in the popup to save the results.

We have calculated that the borehole density in the study area is 0.2 per km2.

In the next section we're going to add a DEM to the project.