The next step is to calculate the total length of the stream network.
Now the tributaries are in different features with their own length. To calculate the total length, we need to dissolve the segments of the stream network into one feature.
1.From the main menu, choose Vector | Geoprocessing Tools | Dissolve....
2. As Input layer choose channels. Don't choose a specific Dissolve field, so all features will be dissolved into one new feature. Optionally, you can save the result to the GeoPackage.
3. Click Run and click Close after processing.
4. Open the attribute table of the dissolved layer.
Now you see that the stream network became one feature. The length field, however, has an incorrect value, because it's not the total length of the new feature, but the length of one of the dissolved segments. Let's calculate the total length of the stream network.
5. Click to go to the Field Calculator.
6. For Output field name type StreamLength
, choose Decimal Number (real) for Output field type and add the $length
function to the expression.
7. Click OK to apply the expression and close the dialog.
8. Click to save the result and toggle off editing mode.
Now the attribute table looks like this:
The StreamLength field gives the total length of the stream network in map units, i.e. meters.
In the next chapter, we'll calculate the drainage density.