 Hello, this is Hans van de Kwaas' senior lecturer at IHE Delft Institute for Water Education. In this video I'm going to show an alternative method for delineating catchments and streams in QGIS. In a previous video I've shown how to use the Saga tools. In this video I'm going to show how to use the Grass tools. The nice thing about GIS is that with the large set of tools that are available we can reach similar goals through different routes, and especially when using open source GIS there are many tools available for us. We'll use the same data as in chapter 4 of the book QGIS for hydrological applications that was written by Kurt Menke and myself, and which follows the Saga procedure. Make sure you have started QGIS with the Grass tools. I've made favorites to the folder, to the chapter 4 folder of the book, so we have exactly the same data. I kept the outputs of the catchment in the channel, so in the end of this procedure we can compare the results. So I start by dragging the 4 SRTM1R2DM tiles to the map canvas, and the start of the procedure is the same. You first have to mosaic these layers. I go to raster, miscellaneous, build virtual raster, because we only temporarily need this mosaic. So I choose select all, here we are. Make sure you uncheck this box, because only for remote sensing images when we need a map stack we use this, then every layer will be put in a separate band. In this case it will be one band which merges spatially, these different tiles. All the other things we keep the same, and I save it to a file, and I call this one mosaic. So it will be a virtual file.vrt, and there we are, it's mosaiced. That's good practice, we clean up what we don't need, so we keep this list a bit clean. Then the next step is to reproject and to subset this, I'm going to show another method that in the previous video we didn't use, but it's easy to do those two steps in advance. In the previous video we did it in two steps. We reprojected using raster projections warp, and then we did a subset using extraction and clip raster by mask layer. We can do it in one step. I can first add bounding box, here it is, and now I go to dm mosaic and export, save as. Make sure it's a geotift that comes out, and the output name will be dm subset. I've changed the projection here to zone 32, if you want to search for these zones, you do 326 for the northern hemisphere, and then you can browse here all the different zones, check where they are, because they're given here on the map. That's a nice trick. So in our case it's zone 32 north, which I previously used, so it's here in history. I'll do OK. And I want to use the extend calculated from the bounding box layer, so there we are. Now it uses the coordinates of the bounding box. Of course it's important that the bounding box has the same projection as your destination projection, the output in this case UTM zone 32 north, otherwise it will not work. And make sure you choose the output resolution, in our case we use 30 meters. Remember that SRTM is one arc second, that's the resolution in degrees, which approximates 30 meters at the equator, it will be a bit less at 52 degrees north, but it's OK to use the 30 meter resolution. And here we can add the no data value, we will use minus 999, and that's all, and then we run it. Now we have our DEM subset in the right projection, as you can see in brackets, EPSG 32632, and we still have to change the projection of our project, there it is, and now we see that our bounding box is square, we can remove the other one and we see below the bounding box the clipped DEM. The next step is to fill, and now we are going to use instead of the SAGA tools we are going to use the GRAS tools. Nice thing about GRAS is that it's very well documented, so if you simply google these different GRAS tools, and we will use the raster tools here, then you will find a lot of documentation, which is much better documented than the SAGA tools for example. So for it mistakes I'm going to remove the DEM mosaic, and if I go now to r-fill-there, make sure you choose the DEM subset, keep the default output aspect direction format, which is in fact the flow direction in the GRAS format, and the only thing we need at this stage is the depression less DEM, so this will be also a geotiff, and I call this one the filled, and run it, gives a warning, which is not a disaster, it will just continue the calculation. Let's in the meantime look up the documentation of the filled-there function on the internet, and here you see how the function works, and you see that previously with the SAGA tools we used the Wang and Liu algorithm, but here we used the Jensen and Domingue algorithm, which is explained here, it also uses the D8 algorithm for flow direction. So meanwhile the algorithm has finished, and we see it here, we filled DEM, the next up in the procedure was to do the Stryler order calibration, so we need to delineate the streams using the Stryler order and select the right order, but the algorithm r-stream order has not been implemented or accessible here through the processing toolbox, so we're going to use the other method using the flow accumulation. You can see these different methods also in my theoretical lecture on catchment delineation, so what we do basically is accumulate a unit of water through the whole catchment, and then where more volumes of water accumulate, we have to determine what is a river by getting a threshold value. You can do that using the r-watershed tool. Remove DEM subset, and we use the r-watershed. Make sure DEM field is chosen, and we use here a threshold maybe of 500, the minimum size of exterior watershed. Let's check in the manual page how this works. So this is the threshold, which specifies the minimum size of exterior watershed basin in cells. We put it on 500, if we make it too small then it will cause some errors, will not be always possible to calculate it. We use the single flow direction because that's also a fair comparison then with the other algorithm from Saga, which uses the single flow direction. You could play around with it and see the effect of using the multiple flow direction. There are all kinds of other options that you can use and try out. Then we're going to save this number of cells that drain through each cell, that's the flow accumulation, so I call this one accumulation, and we're also going to output the drainage direction, in this case that will be the flow direction, the TIF, and I'm not going to output the other ones, you can try those if you need those variables, but in our case we don't need them. You see you can even calculate the topographic wetness index, stream power, so that's basically it, and then we run the algorithm, give some errors, but that's not so relevant for us now, because it will still output what we need. So here you see the flow direction in the grass definition, it's important to know how it's encoded, go to style it using palette unique values, let's say classify and here I get all the values, the positive and negative values in the file, let's check in the manual how these drainage directions are numbered, and we see that that's different than the number in Saga for example, so the drainage direction is eight directions numbered counterclockwise starting from one northeast direction, the value zero indicates that the cell is a depression area defined by a depression map, and a negative values indicate surface runoff is leaving the boundaries of the current geographic region, so the absolute value of these negative cells indicates the direction of flow, so we need the absolute values. So to calculate the absolute values we can use the raster calculator, and what we're going to do is use some condition, and to make conditions in the raster calculator it's quite easy, we can use the sums of products, so here we say if flow direction is less than zero then multiply it with minus one times the value of the flow direction for those cells, so then those values will become positive, and then we can add the positive condition, so when flow direction is larger equal zero, so when those are true then we do times flow direction, because if it's true it's one, so it will be one time flow direction, so we save it to a new file and then we run it. Let's check the values and do some styling, so it's pelleted unique values because these are discrete numbers, and I click classify now I find all the unique values there, and indeed it's what we want, values from 1 to 8, and all positive. Now we're going to style the flow directions in the same way as we did for the Saga tools, and as explained in chapter 4 of the book, we choose the spectral ramp, and we're going to edit the ramp. I will make sure that the first color is the same as the last color by using the color picker, and then we set the different colors for the stops. Let's first label these values as if it were the Saga flow directions, so that will go from north to northwest, and then clockwise, which is of course different than the grass tools, and now we change the values to correspond with the values for grass, as we saw in the manual. So in this way we reproduced the Saga flow direction ramp for grass with the correct values. Let's remove the flow direction layer with the negative values. This is the layer with the flow accumulation, and it has quite a huge range of values, so what we need to do is to check a bit the values of accumulation, and we see that here downstream we get very high values, and the more upstream it's of course less, so we need to determine a threshold value for which we can say okay that is what we call a river, and in this case I'm going to use a value of 50,000, but you need to calibrate this using OpenStreetNap for example. So use Raster Calculator, and I just say if the flow accumulation is larger than 50,000 then I call it a river, so I'll call this one channels, and then run it, and then I get the channels, and we can zoom to the layer, and I can style this, and we don't need the zeros, and I want to make the ones blue, and I remove the accumulation layer, and I'm going to add OpenStreetNap, and here we can see the result of the flow accumulation, and we determine the threshold based on the smaller streams that we can see upstream, and see how well it matches, so we can increase or decrease this threshold value to further follow the river, or to less follow it. Okay the next step that we need to do is extract the streams, so in these grass tools there's our stream extract, and as an input we give the filled DEM, and I give here the minimum flow accumulation 50,000, that we have determined in the previous step. The other things I keep as default, and I want the streams as a line, so the output type of the vector should be line, and here I can choose the roster that comes out, let's call this one streams, and here the same for vector, save it as a geopackage if we want, but we don't need that, because we already have it. Close it, and of course it now resembles what you already had more or less, and we have the streams in vector format, we can style it, here we see the streams. Let's try to find now the outlet, if we compare the OpenStreetNap with the delineated channel, is where the roar gets into the to the mass of the mouse river, I'm gonna take the outlet somewhere there, and it's also good to take that from the pixels, so we can see the area that we need to stay within, use our water outlet. Make sure to choose here the flow direction map, and to choose the coordinates of the outlet, let's choose it somewhere here, and then we can simply run this, and we call this roar catchment grass, and I zoom to the layer, then here is our catchment, and I can do roster to vector, to convert this roster area into a polygon, let's choose area for the output, so it becomes a polygon, and we choose an output name, save it as a geopackage, let's call it a roar catchment grass, save, and then we run the algorithm, there it is, in vector format, and I can style it, let's change the simple field to an outline, and let's make it blue and a bit thicker, and yeah this is basically the result, and what we can do now is compare it with the saga one, so we have here from saga the catchment shapefile, and we have the channels, and let's compare them, first the catchment, I'll give it a red fill, and we see it matches quite nicely, there are some little deviations, but overall it results in a very similar catchment boundary, and let's do the same for the streams, and we see that that also matches quite nicely, it depends a bit on the threshold, or strahler, and for the flow accumulation, we can see that in general it follows quite clearly, the same pattern as the open street map, if we are upstream, and where it gets more human affected downstream, there's deviations, but both methods give very similar results, so I hope this was useful for you, and you've learned that you can use different tools available in QGIS to achieve similar results, and that you can start playing around with the different settings of those tools, and see which works best for your catchment.