 Hello, this is Hans van der Klaas, senior lecturer at IHE Delft Institute for Water Education. In this video I'll demonstrate how to derive the catchments or rather the subcatchments of multiple outlets that are automatically detected from a DEN. And we will use the PCRuster tools in QGIS for this. In another video I've demonstrated how to do that using the Python scripts with PCRuster. Here we'll use the user interface of QGIS. We're going to follow the following workflow. First we need to convert the DEM geotiff to the PCRuster format in order to apply the PCRuster tools. Basically the tool performs a GDOL translate. And then we can derive the local drain direction map from the DEM, which is basically a flow direction map and that forms the basis of all kinds of flow analysis in the PCRuster tools. And we use that as an input to calculate the Stryler orders. Then we will check by styling which Stryler orders we consider as rivers. And we use the Raster attribute table to create a lookup table to reclassify those Stryler orders to the ones that belong to the river. Then we can compare the Stryler order of the downstream pixels. And if there's a difference it means we are at a junction and this is an outlet of subcatchment. So in this way we can derive the outlets. And then we use those outlets as an input to derive the subcatchments. And meanwhile with a few of these steps we also need to convert the data type and check how the Boolean layers are with no data or the zeros etc. So you'll see this all in the next steps. So let's convert the geotiff to the PCRuster format. And because it's a continuous Raster we choose the scalar output data type. They save it to a file. Make sure you choose the dot map format. And I can remove the geotiff not to get confused. So the next step is to derive the LDD map from the DEM. And we use LDD create for that. And we're going to fill all the things. That's what this tool does and it ends up with the flow direction map. The LDD map, local doing direction layer. So I keep here all the defaults and just specify an output file name. Call it LDD and then run it. It takes a bit because this is quite an intensive tool. And here's the result and the flow directions are encoded with the same numbers as your numeric pad. So it starts with one in the southwest and then two south and three is southeast, etc. Now we can use the stream order tool to derive the Strahler orders. The local doing direction map is an input and the Strahler orders are the output. I'll save it as strahler. And the output will be an ordinal Raster with the order numbers for each pixel, starting with one and ending with the maximum that it finds in the study area. So we can style the layer because it's ordinal. We need to use the palleted unique values and we use blues. So the blue are the bigger the river. There we see that it found 10 orders. So now we can add an attribute table and choose the GDAL format. We need that later to do the reclassification and you can do this using the Raster attribute table plugin. I've added OpenStreetMap from the browser panel because we are now going to calibrate which Strahler orders we consider as rivers. So we compare the results by removing stepwise from the lower orders to the high orders and see if we get comparable results as with the OpenStreetMap rivers. If for your study area OpenStreetMap is incomplete with regards to rivers, you can also use a satellite image as a background. So you need to end up with a threshold value for which you consider that the Strahler orders are reflecting well the rivers in the study area. I think here it's around seven or eight that gives a good fit. In certain areas it will fit better than in other areas depending on the land use, the human manipulation and the geology. And when I follow then the Strahler approach we need to renumber it to one, two, three and four for the orders seven, eight, nine and ten from the Raster derived Strahler orders. Now we can create a lookup table using this attribute table and we want to get rid of the low orders. So go to editing mode and make the orders until six, zero and the rest one, two, three, four. And then I save it and we can use then the lookup table from Raster attribute table two. Make sure you choose the Strahler order layer. Then I'm going to save it. So this will be a PC Raster lookup table format and this is how it looks like. But we don't want the zeros, we want no data. So we only end up with the channels, one, two, three, four Strahler order and the rest of the Raster will be no data. Then we can use the lookup tool and we choose Strahler as an input, then our lookup table and the result is ordinal and then I run it. We end up with an ordinal layer. So I use Palette of the unique values and it's better to use blues. And there we see the four orders and the background is no data. The next step is to know what Strahler order value the downstream pixels have. So I use the downstream tool and the flow direction is an input and we use our Strahler channels as an input and then we derive the output which gives us for all these river pixels the downstream Strahler order value and we end up with the same amount of order so that looks good. So with some map algebra we can then find out where the junctions are. So go to the Raster calculator. You see that it recognizes the PC Raster maps too because it's a GDAL format and I say where the Strahler channels values are not the same as downstream. We have junctions so it will be Boolean true, otherwise Boolean false. Remember that you can only save it here as a tiff file and not to the PC Raster format that doesn't work. And here we have our junctions but we have to style it in a proper way in order to see it. So it's Boolean and here we see in red those junctions. So we're almost there because those are the outlets of our subcatchments. Now before we can further process this we need to convert this output back to a PC Raster format and we choose the Boolean output data type called the junctions. Make sure it's a dot map format. We run it and what we want in the end is that each catchment has a unique value because now it's only Boolean and that wouldn't be very interesting to look at. So I'm going to add a unique value using the unique ID tool. So each of these Boolean points will get a unique number starting from 1 to the maximum that it finds. And here we see that there are many and that will be the numbers also of the catchments that we will derive. Now the problem is that the unique ID tool produces a scalar output and we want it in the nominal format. So therefore we need to convert the data type of the output of the unique ID. So we go to convert layer data type and we change the data type to nominal. It's also because the catchment tool can't deal with scalar. It needs to be Boolean, ordinal or nominal and now it has the right data type. Now the only problem is that the catchment tool will calculate it for non-zero values and expects also zeros. So we need to create a layer with zeros that are nominal and then we can use the cover tool where we choose the junctions ID nominal layer and we are going to fill the node data with the nominal zeros and we choose then an output name which will be the outlets. So with the cover tool we fill the node data with data from another layer or multiple layers in a sequence. So this is the result and now we can use the catchment tool which uses the LDD and the outlets and here we have our catchments. Let's style it to make more sense out of this and here we see for each of those unique numbers of outlets the catchment to which it belongs. There's also another tool called subcatchment and because the catchments are nested which means that if a more downstream outlet is used that it will cover also the upstream catchment. Now the subcatchment tool doesn't do this so it will contain all the subcatchments but of course then it cuts the nested ones so here we can see the result and we end up with many more subcatchments compared to the catchments tool output. So it just depends on what you want and people also often ask why don't we get the strahler order numbers there and we can use the area maximum tool that's an easy way to derive it because we have our strahler orders and we have the catchments so if I take the maximum value within the catchment then it will give me back the strahler orders in these subcatchments and if I use blues there then we see the different orders clearly for each of these derived subcatchments. Of course in GIS there are other ways to come to the same result but this was the easiest to get the strahler orders assigned to those derived subcatchments. Now this was a lot of clicking and there are multiple ways to automate this so there's another video that explains how to do this with Python code but you can also make a graphical model out of this in QGIS or you can create separate tools like a junction tool or a derived river tool by modifying the scripts from the PC Raster toolbox here in QGIS which is not too difficult if you know a little bit of programming.