 Hello, this is Hans van der Kwas, senior lecturer at IHE Delft Institute for Water Education. In this video, I'm going to show you how to automate the stream and catchment delineation procedure using the graphical modeler in QGIS. So we need to prepare some data before we get started. I need the DEM tiles and a bounding box for the study area. Here I have four DEM tiles from SRTM. And in the processing toolbox, I go to create model and then I end up in this window with the processing modeler. And I give the tool a name and a group to which this tool will be added in the processing toolbox after we have saved it at the end. Then I'm going to define the inputs. And you can of course identify each raster layers separately, but I use here the multiple input and I give the name the DEM tiles and make it the raster type so you can only open there a set of raster layers, which are your DEM tiles. Then we also need a vector layer, which is the bounding box defining your study area and choose for a geometry type polygon and then we click OK. Then we can add the algorithms and first we're going to mosaic. So I built a virtual raster and these are the same tools as you find in the processing toolbox, but you can give them different names. I call it mosaic DEM tiles. We use the DEM tiles that were defined as a variable. Then we put the same things there as we would normally do, so we don't want the layers to appear in separate bands. Then the next algorithm is warp to change the projection. So we project and we can clip also at the same time with this tool. So we project and clip the DEM. As an input layer we use the output from mosaic DEM tiles. I define here the output projection, but I can also use that from the bounding box because that's the projection we're going to use. I set a no data value and the output spatial resolution I set it to 30 meters, which is approximate for the SRTM one arc second product. I switch on the advanced parameters and there I use the extent of the bounding box as the geo-referenced units of the extent of the output. The next thing we can do is to fill the no data, so fill the voids. They might be in your DEM, maybe they are there, maybe not, but anyways we cannot differentiate there, so we'll do that anyway, that step. I increase the distance and that's okay. You see it nicely adds these functions and connects them to each other and to the input data. Then we have to fill the sinks and I'm going to use the Wang and Liu algorithm. Make sure we use the output from the voids and we can output here the filled DEM, not the other ones. If we define an output that means that it will be saved on your disk and identified as an output file and it will be a green box in this scheme. I make that an output because we need it later. Then I want to add another input variable which is the strahler order threshold which you can determine before or you can calibrate it. Strahler orders always have a minimum value of 1 and I put a maximum of 20 and a default of 8. Then I can add the channels and drainage network algorithm, use the output, the filled DEM and then refer to the strahler order threshold input variable and it will output all these layers but what I need as a real saved output are the streams. So this algorithm will output the filled DEM and the streams. Then I would like to define a vector layer with the outlet as an input and normally you can identify the point on the map but it needs to be snapped to the delineated channel, so the streams file here. I'm going to use the snap geometries to layer and rename it snapportpoint, that's how it's called in some other software. And as an input layer I use the outlet on map input and the reference layer the channels. So it will snap to the channels and we can put there a tolerance but it's also nice to make it variable and I need that as an output, it's a snapped outlet. You can move these boxes and they still remain connected, actually I don't want that as an output. So I want to identify the tolerance and make that variable and here you can define it in a meter, so between 1 pixel of 30 meters and 5000 meters will be okay and then I can add it this function and make it refer to the right input which is the tolerance. And another thing I want is the geometry, the x and y coordinates, so I need to add another algorithm and that is add geometry attributes. I do that because in the next step we need the coordinates of the x and the y of the point to delineate and the catchment belonging to that snapped outlet point. So I call this one save outlet with coordinates, the input layer is the snapped geometry and then we can define here the output layer, call it snapped outlet, there it is. So three outputs for this algorithm, filled DEM, streams and the snapped outlet, save it, give it a name, goes to my profile by default. So I'm going to hide all layers because I want to identify now the outlet on the open street map. So as an input we need to define the outlet before we run the algorithm, so I want to delineate the roar catchment, the same one as in the manual procedure, so I create a scratch layer with the point geometry in the correct projection, that's important. Click okay and I add the point at the place where the roar comes into the Mose River. Save it and then I find the model under models hydrology stream delineation, I choose the bounding box, I choose the DEM tiles, the outlet, Stryler order, I increase the tolerance here because that's needed and I leave the others open to have temporary output and then it runs our model. Gave an error but it's still computed, so I zoomed to the area and because we didn't specify output names it will just give some default names but segments are our channels and I can style it, there it is and the filled DEM. Now I want to make a second model to delineate the catchment because this one delineated the streams but I need that as an input to delineate the catchment. Let's have a look at the snapped outlet, how that worked, so it moved the outlet to the line. So I'm going to create a new model, I call it catchment delineation and I put it also under hydrology and there I need a few inputs, I need the raster layer, it's the filled DEM of course as an input, I need a number which is the X coordinate, I don't put restrictions there because I want it to be a generic tool for any projection that you want to use at any location, a field for the Y coordinate and we use the upslope area tool to calculate the catchment so I'm going to rename this to delineate catchment, we take the X coordinate and the Y coordinate from the variables that we define, elevation the filled DEM and we use here the default methods and that then generates the delineated catchment. However, we don't want the raster, we also want the polygons so I'm going to use the polygonize and rename it polygonize catchment, make sure to choose the upslope area output, keep the defaults but remember that we have two attributes in our attribute table of the polygonized catchment where only value 100 is the catchment so I'm going to use here extract by attribute and I call it save catchment polygon only and I type here the field name and it's their operators equal and then 100 so I only select value 100 from the DEM field which is the field which we created previously and then the output is the catchment boundary so that will be then the result, I save the model and I can now run the model, so run catchment delineation, I use the filled DEM, now I can use the coordinates from the attribute table of the snapped outlet, simply paste them here and I leave that at default, run the algorithm and there it ends up with the catchment, if I click zoom to layer you can now see that it delineated the whole ruer catchment as a polygon and that's what we wanted so with two added tools we can do the whole procedure of catchment delineation and you can continue styling that if you want to make a nice map. I hope you've enjoyed this video, please subscribe to my YouTube channel for updates. For more free materials on GIS please have a look at IHGDelft OpenCourseWare at GISOpenCourseWare.org