 Hello! Welcome back on my YouTube channel. In today's video I'm going to demonstrate how to delineate the contributing area of a reservoir lake. I'm going to demonstrate this for the area here in the map canvas, and I've downloaded the dam line from OpenStreetMap using the quick OSM plugin. I've projected the dam line to UTM Zone32 North, which is the projection I'm going to use in this project. You can see that when I hover my mouse over the dam. Now I also need a digital elevation model. I'm going to use SRTM 30 meter and I use the open topography dm downloader plugin to download that. In another video I've demonstrated how to use this plugin. Let's first rearrange the layers in the layers panel so I can see the dam line on top of the elevation model. So now we see where it is. And the dm that we have downloaded is in EPSG 4326, which means the geographic coordinate system. I need to convert this to the projection of our project. In order to make it square, I'm going to zoom in a little bit, and then I use export save as. I choose the output file name and I change the CRS to one of the projects. And very important I choose here the map canvas extent so it will be square. Therefore we zoomed in before. And also important to make the pixel square and choose their 30 by 30 meters. You can leave the rest as is and click OK. And now we have a square copy in UTM of our DEM. Here we see it. For the rest of the analysis we're going to use the PCRusterTools plugin. For that purpose it's important to convert our DEM to the PCRuster format. It's scalar data type and I choose the output file name. You can find more information about PCRusterTools plugin and how to install it in other videos. So here I have a copy of the DEM in the PCRuster format. But our dam is still a line and I need to convert it to raster for further analysis. I use the rasterize tool from the raster menu and I choose one for a fixed value to burn because I'm creating a Boolean raster. I use geo reference units of 30 by 30 meter cells and for the output extent I choose the DEM from PCRuster. Note that you cannot save the file into the PCRuster format directly so I'm first going to create a geo tip. Let's check the result. It's indeed a line but then in raster format and you can style it with palleted unique values and there we see that it has Boolean true for the DEM. Now we can also convert this layer to the PCRuster format for further analysis. So as input I choose the DEM. It's a Boolean data type as we have seen and I choose the file name DEM PCRuster. When I run it it creates a copy in the PCRuster format. I can copy the style and here I see the result. It's the same as our geo tip. Let's remove the geo tip to avoid confusions. So we need to calculate the flow accumulation to find later the maximum flow accumulation which will define our outlet and in order to do that I need a flow direction raster and I need a material raster. So I use ldd create to create the flow direction raster. As an input I choose the DEM and I call flow direction. Keep all the defaults. When I zoom to the layer I can there see the flow directions and if I move the dam on top of it I can see where it is and I need a material layer. If I set it to material for each pixel of one unit output data type scalar then it will accumulate the amount of cells which is sufficient for our application. So this generates a raster which has for each pixel value one. So now I can go back to the aquiflux tool and for ldd layer I choose flow direction for material the material layer and then I can save the result as flow accumulation. Now it shows for each pixel the amount of upstream pixels that accumulate at that pixel. Because the values are quite extreme I'm going to use single dump pseudo color and I choose blues. I have this little bug in this version on this computer so I use CPT city. I saw that in 328. I don't have that problem. Here I go to cumulative count to deal with the extreme values and there you can see where the flow accumulation high values cross the DEM line and our purpose now is to find on that line the maximum value flow accumulation and that will be our outlet. For that purpose we can use the area operations which are zonal operations. Our class raster is the DEM line which is true for the DEM and we use flow accumulation as the scalar input raster and that will give us the maximum flow accumulation value for the line. Let's move it to the top and check the values. Use palleted unique values and there I find that 12,416 pixels are the maximum flow accumulation on the line but now each pixel on the line has that value so I need to use a comparison operator where I say that when the flow accumulation equals the maximum value then create a boolean which has the outlet pixel of our catchment that we are looking for. So here we see the maximum outlet pixel and I can also style that with palleted unique values. It's boolean with true for our outlet and zero for the other pixels. You can see that. It's at the corner of our DEM line but that doesn't matter. It's a model that we are building here so if I now go to the catchment tool I can delineate the upstream area based on the flow direction and this outlet layer. Look called catchment. I run it. We zoom to the layer and this is the contributing area and we see that even beyond our DEM there are a few pixels contributing to the area that has to do with inaccuracies in the process and in the DEM and maybe also in the DEM line. So I polygonized this raster because I would like to have the boundary as a polygon. It has the result. Let's remove the areas that are not part of the catchment. So the zeros. Save the vector layer and let's change also the styling to a simple outline. Give the red color a little bit thicker and let's remove some layers below so we can see the result on the open street map. So this is the area that contributes to the reservoir lake so all the water that falls in that area will drain towards the DEM line. If you need to do this more often you can create a graphical model or processing tool. I hope this was useful. Please subscribe if you want to get updates on new videos.