 Hello, welcome back at my YouTube channel. In today's video I am going to show how to calculate the height above the nearest drainage or hand. I will use the PCRusterTools plugin in QGIS. We start with the DEM from SRTM which has been clipped to a smaller area. The start of the procedure is the same as calculating the flow accumulation because we are going to derive the rivers using the flow accumulation first. We need to work in the PCRuster format so I choose from data management convert to PCRuster format and I choose as an output data type scaler because it is a continuous raster and I call it DEM. The next step is to calculate the flow direction map or local drain direction map. You can do that with the LDD create tool. The input is the DEM. We keep the defaults to fill the sinks and I call the output LDD. As you have seen in another video we can calculate the flow accumulation but we need a material layer of scaler value 1 to accumulate the amount of pixels that is what we need so we don't need as an input rainfall or something else. So here with the spatial tool I can create a raster which has value 1 in the scaler data type. Then in the aquiflux algorithm I can use the LDD map and this new material layer and I call the output flow accumulation. To derive the rivers you normally need to calibrate this with a map reference layer which has the river or satellite image but here I'll use a threshold that I've determined before. I need to create a scaler layer with the threshold value. I'll use here 30,000. Again you need to calibrate this so it will not be 30,000 in all cases. Call it scaler and I'll save this as flow accumulation threshold so again the result will be a raster with this value in the scaler format for all cells in the raster. Now I can calculate the rivers using a conditional. I use a comparison operator where I say flow accumulation is larger or equal than the flow accumulation threshold and I can save this as a river. So the result will be a boolean layer with the rivers. Let's quickly style these rivers using a palleted unique values renderer and remove the zero so we only have the ones where the rivers are and there we see it on the DEM. The next step is to calculate the catchment of each pixel of the drainage and therefore I need to give each pixel a unique ID. You can do that with the unique ID tool which result in a scalar map with for each boolean true pixel unique ID. Let's style it. Here we see that now each river pixel has a unique ID and all the non-river pixels have a value of zero. To calculate the subcatchments we need to have those IDs in a different format. They need to be nominal. So I'm going to convert the data type from ID scalar to ID nominal and this results in exactly the same map but then with each unique value as a nominal. Now we can use the subcatchment tool to calculate the catchment of each unique value of the drainage. We use the LDD as an input and we use ID nominal as the outlet layer and let's call the output subcatchment. So each subcatchment now has the same value as the ID of its outlet. We can style that and we can also copy the style to the outlets to do a quick check if it's the same. You have to remove the zeros because the zeros have not been used as the subcatchments and now if I zoom in and I switch on and off ID nominal I see that there's no difference which means it's exactly the same. Now we can calculate the elevation of the drainage by choosing the minimum elevation in each zone. So I use here a subcatchment as the zones and I use the DEM as the raster from which we want to know the minimum value in each zone and I call the output Z drainage. This is the result and now we can calculate hand because that will be the value of the DEM minus the elevation of the drainage and I call the output hand and this is the result. So here for each pixel we know the height above the drainage. In a similar way we could calculate the ridges but the ridges are shared so that's a bit more complicated. I hope you've enjoyed this video and if you like these videos please subscribe to the YouTube channel also check the free course materials at GISOpenCourseWare.org and I hope to see you again next time.