 Hello, welcome back on my YouTube channel. In today's video, I'm going to address challenges that QDS users have with stream and catchment delineation. I'll start with a quick overview of the stream and catchment delineation procedure, which is generic for all GIS tools. Next, I'll discuss the concept of processing provider plugins and the choices that you have. If that's all too complicated, skim to the end of this video where I'll give tips to do the stream and catchment delineation, quick and dirty. But first, let's have a look at the general workflow for stream and catchment delineation in GIS, which is more or less the same for all tools. If you need more information on the theory, have a look at this video. I'll now just quickly go through the theory. First, you need a DEM. If you download the digital elevation model, this is often provided in paths, which you need to stitch together. This is what we call mosaicing. DEMs are also often provided in the geographic coordinate system and need to be projected to a Cartesian projection with x and y coordinates in meters. Otherwise, this workflow doesn't work. And the challenge is that the DEM file now is often too large, which slows down the calculations. Therefore, you need to clip the DEM to the study area. This needs some expert knowledge of the study area. However, if you clip it too small, you'll end up with a catchment with straight boundaries. So rather make it a little bit too big. Next, you might need to interpolate voids. These are pixels with no data in your DEM. You also need to remove depressions in the DEM that trap the water and prevent it to flow to the outlet. This can be caused by artifacts in your DEM. They're called sinks, and they can be removed with the fill sinks algorithm. If you have a river layer, you can then burn in the stream network to create more realistic results. Next, you can calculate the flow direction, and you can use this to derive the streams in your model. This can be done with the flow accumulation method or with the strabler stream order method. In both cases, a reference layer with the stream network needs to be used for calibration. This can also be a satellite image if map data is not available. Now we're almost done and need to define the outlet point on the delineated stream. Otherwise, we can't derive the catchment in the next step. Often this point is offset from the outlet on the map due to human modifications of the landscape or inaccuracies in the DEM. Finally, we need to export the results to our model format or create a nice map. However, with this procedure, you need to keep a few things in mind. Your choices in the workflow depend on the case study. If you are in a flat area, these algorithms are not going to work. And you might need to do this manually or use other methods. If you want a catchment for a specific outlet, you can use this workflow. But if you need to have all subcatchments or catchments in a study area, you can also look for the lowest points, the sinks in your area, and delineate the catchments automatically for that. With PCRuster, for example, you can use the PITS algorithm to find those and then feed that into the catchment tool. If you have already a river layer available, then it is useful to burn in the stream network in your DEM to get more realistic results. Often, however, this can be a little bit difficult and depends also on settings and algorithms. If your area is very large, you might want to use more robust tools for the fill sinks algorithm. Also, you could choose to have quarter pixels. Because for very large catchments, it doesn't really make sense to use the finest pixel resolution. Also, don't forget to interpolate the voice. Or if your catchment ends up in a lake or in the ocean, you need to mask these pixels. Otherwise, the wrong elevations there will be also used in your algorithms. Now, which tools are then available in QGIS? Unfortunately, QGIS doesn't offer the tools for treatment catchment delineation as core functionality. In the past, Saga and Grass were installed automatically with QGIS. But now they are only available as processing provider plugins because they are third-party tools. This means that you have to install both the plugin and the software. Saga, Grass, PC Raster, and Whitebox tools can be used for treatment catchment delineation. They're all processing provider plugins now. Windows users can easily install Saga, Grass, and PC Raster through the OSGO 4W installer. Just watch the video over here. Whitebox tools is available through installers on their website. In the first edition of the book QGIS for hydrological applications that I had written together with Kurt Menti, we have used Saga for the treatment catchment delineation workflow. Since Saga is not anymore included in QGIS, there are also issues now with the upslope area tool that we need for the catchment delineation procedure. If you still want to use Saga tools in QGIS, you need some workarounds. You can check this playlist to learn more about it. In the second edition of QGIS for hydrological applications, we have therefore switched to the PC Raster tools plugin, which provides a robust tool for this workflow. We have a lot of choices and algorithms, but which plugin should we use now? Well, that depends on several factors. First, you need to be able to install, of course, the processing provider plugins. If you are a Windows user, you can install them easily using the OSGO 4W installer. For Linux or Mac, you need to install the package from a package manager or website tool. Often, users already give up on tools in this page. If you encounter problems with installation, don't hesitate to find help on fora or post your question in the comments of this video. So now you've managed to install all these processing provider plugins. But other than the differences, well, actually, they are not so large. You can use all these tools to do the workflow of screen management delineation that I've presented before. They use very similar algorithms and only differ in details. Let's focus on a few of these details. What users occupy the annoying is that PC Raster uses its own data format, which is a GDAL supported Raster format. PC Raster needs this because it is very strict with the data types. Every tool needs to have the correct data types as an input and provides data types as an output. This is to prevent that the user does unexpected things. For example, if you want to calculate flow direction with the LDB create tool, you can't feed it with an integer Raster. It needs to be a continuous Raster in the scalar format. Another difference with PC Raster is that it provides the whole PC Raster Python package and framework that you can use to build your own tools and to create spatial dynamic models. Another difference is that PC Raster with the LDB create tool combines the fill sinks and the flow direction tools and has more parameters to control the fill sinks. Saga and Whitebox tools have multiple fill sinks algorithms that can be used to speed up the process for large areas or to see if certain algorithms work better. However, the Saga plugin, as already mentioned, has issues and is less robust. Also, with PC Raster, you probably need to connect more building blocks for the workflow because it has lower-level building blocks, which can be aggregated if you know some programming into higher-level building blocks or even in one push-off-the-button tool. So, can I combine these tools then? Yes, but you have to be very careful. The problem is the flow direction because the flow direction calculated with these tools give different output. Not as much in the flow directions that they calculate but in how they are encoded into integer values. For example, here you see Saga. Saga uses zero for north, then one for northeast, et cetera. Then flat areas have a value of 255. On the other hand, PC Raster uses the numeric pad of your keyboard for those values. So, eight is north and nine is northeast and five is flat. This means that if you want to exchange tools between these providers, you need to recode these flow direction rasters so they have the correct values that the tool expects to have. So now, after seeing this video, you might think, hey, I've seen easier tools. I just want to push a few buttons and then get the result. Why is this also difficult? Well, first of all, you need to realize that for education purposes and for experts, it's very important to understand the workflow behind the button that you're going to push. Because this push of the button method will not always give the correct result, might not be applicable to your study area or you want to experiment how you can improve the results by using different algorithms. So my advice is if you're learning this, is first try to automate this using a graphical modeler. After that, you can make a PyQl script that does the job in an easier way for a user or for yourself. You want to repeat tasks. There are tutorials available at GIS OpenCourseWare. For example, this tutorial on hydrological analysis and modeling with PC Raster that shows you how to go from the click approach to more automated approaches. If you want to automate, you can create a graphical model. And with PC Raster, this is available also for download if you go to the QDS resource sharing plugin and I have more videos on my YouTube channel explaining this which you can find here. For Zaga, there's one available via the QDS model hub. The next step in automating is using PyQl scripts. These become then available as processing tools in the processing toolbox. I've shared a few of them using the QDS resource sharing plugin and there's another video that shows how to do that. You can find it here. Behind these tools, there are other pre-tools available. A lot of users mentioned the Q-SWAT plus tool or the pool that comes with hack HMS to delineate your catchment. Another very nice tool that is built on QDS is Leica. It's built by Vincent Kloerig and it provides stream and catchment delineation as well as a lot of hydraulic tools that you might need in your job. It can be downloaded freely using a link that I'll put in the description of this video. I hope this video was useful to answer many questions that you have. If you have more questions, don't hesitate to put it in the comments of this video and follow me for more answers to your questions. Thanks for watching and hope to see you next time.