 Hi, I'm Hans van der Kwas, lecturer at IHE Delft Institute for Water Education. In this video I'm going to show you how to derive the percentage of land use, land cover, in different subcatchments. For this purpose I will use a polygon shapefile of catchments. These are subcatchments in the Ruhr in Germany and we will use the land use from the Korean land cover data from the European Commission, which you can download easily from the internet, from the Komparnicus website. You see the warning that it's not yet validated data from 2018, but I will still use it for the demonstration. Of course you need an account to download it, and then you have a choice of different file formats, and we will use here this Q-Lite database, because that's an easy one to use with QGIS. This one is a raster format, and that's the SREU database. It's big, so I already downloaded it. So here you see the database, and there's the polygons with the land use, land cover data in it. I'll drag it here, here you see all the polygons. Let's first style, and when you download it, it comes with a style file, and you can choose the file from the legend folder that comes with the data, and if you choose the QML, that's already the QGIS styling file, and we do load style, and there you see all the classes. Make sure that you choose the right column, which in this case is code 18, and these are the land use codes, and that's then the name of the land use, land cover class. As you see, there are three digits, and they're the different levels. As part of this demonstration, I'm also going to show you how to aggregate this to the main land use, land cover categories such as urban, agriculture, semi-natural, etc. There it is in the right colors, you can see here the legend. And we have the catchment polygons. In our previous video, I've shown how to derive the catchment polygons from a digital elevation model. Here we are going to use these catchments to derive the percentages. Let's first change the style, you can use the layer styling doc for that, and let's make them transparent, and let's make the stroke width a little bit thicker, so we see the borders. So the idea is that for the aggregated land cover classes, we get the percentage in each of these catchment sub-catchment polygons. Let's first treat the catchment polygon file. Go to the attribute table, and there we see five polygons, and what we see there is that they all have the same number, that's a result of the catchment delineation process. And what I'm going to do first is replace the DN value with a unique number. So I can do that by changing this to dollar ID, that will generate for each polygon a unique number. I'm going to update all, and now we get a unique number, and I'm going to create a new column to calculate the catchment area, call it catch area, and that will be a decimal number. To make it a bit big, it will be in square meters, and I want two decimals, and there it is. And there's another internal function for that that is called $area, that will calculate the area, and make sure that you write it to the right column, so catch area in our case, and then I click update all, and here we see then the catchment area in square meters. So I'm going to save this. So the idea is now to intersect this one with the land use land cover classes from Corrine, and then calculate the class area of the intersected result, and make the proportion with the catchment area that will result in a percentage per class. So there are a few more steps we need to do. This map of course is too large, and it's in the wrong projection. If you hover your mouse over the layer, you can see the file name of course, or the database in this case, and you see the EPSG code, 3035. We need to be in 32632, which is the UTM zone 32 north projection. So you can do that in one step, I'm going, clicking right, and then choose export, save features as, and I'm going to choose the output name, let's make it a shape file, and I call this Corrine 2018 reprojected, and here we can change the projection to the one of the project, the UTM, and I can change here the extent of the calculation, and here we can choose calculate from layer or from the map canvas extent, and I choose here the catchment polygon. So the result will be only the boundary of our catchment polygon, so we don't have too much data of the rest of Europe in the calculation, okay, and there it is. Now we can copy the style in this one, and there we are, so we can remove the original file, and now our area is reduced to the polygons. The next step is to aggregate the Corrine classes that are now at level 3 to level 1. So I go to the attribute table, and we're going to edit, and I'm going to calculate a new column, and we are going to call this level 1, it's a whole number, an integer, and the length is one digit, and now I'm going to make the equation here, level 1 equals, and now we need to use the expression dialogue, and there we use the case function, case, when, and then the field, code 18, and here you see all the unique values, if I click all unique, so this one, code 18 selected, if it's larger or equal to 100, and code 18, if you double click it automatically comes there, is less than 200, then the result value is 1, and we can copy this line a few times and modify it, it's larger than 200, and less than 300, then we call it class number 2, here we do 300 to 400, class number 3, and here we do 400 to 500, class number 4, and we see that it goes up to 500, 11, 512, so we can make the last line, if it's larger than 500, then 5, and you end the case function with end, and the preview shows that we get some sensible result, so we click OK, now the whole equation is filled in here, level 1 equals, and then that selection, and now I update all, and I get here all the levels, so you can see that 112 is 1, that 312 is 3, and 512 is 5, save the file, the next step is to dissolve the land use classes, because we can see that many polygons have now the same value, class 1, class 2, class 3, and they need to be considered as one feature, and to reduce the amount of features, so I'm going to use the dissolve function for that, vector, geo-processing tools, dissolve, as input we use the Corrine re-projected file that we have, and we're going to dissolve based on the level 1 field, that means that everything with number 1, each polygon with number 1 will become one feature, et cetera, and we save the file, Corrine 2018, dissolved, we run it close, and here we see the dissolved version, so if I open the attribute table, then it should reduce to the 5 classes that we have, and we can give it some random color, categorized, level 1, classify, I'm not going to spend time on changing the colors now, and here we see now the different patches in the polygons of the catchments, and now what we need to do is to intersect the catchment polygons with the land use polygon, so we can calculate the fraction or percentage within each catchment polygon, therefore we use the intersect function, vector, geo-processing tool, intersection, and what we're going to intersect is the Corrine data with the polygons, so they are cut, the classes will be cut into pieces based on the border of the catchment polygons, and we keep all the fields, and we save the output to Corrine catch, intersected, and then we run it, and this is an error that relates to the geometry because of the catchment delineation and the cell size, there can be some geometry problems, the best way to solve this is to before the intersection, so if you get the error, which you often will get, you go to vector, and the quick fix is to calculate a negative small buffer, so the problem is the polygons of the catchments, and we put the distance here at minus 0.001, we keep everything else as default, and we save it to catchPolyBuffer, and we run it, it's very quick, close, we can copy the style, we can remove what we don't need to not make mistakes, and let's see if now the intersection will work, go to the intersection, and the input layer is the Corrine dissolved, and the overlay is catchPolyBuffer, we keep all the fields to get all the attribute tables as well from the polygons of the catchments as from the land use land cover dataset into the output file, in which we call Corrine catch, intersected, it made something previously, but that was maybe not correct because of the error, and then we run it, now it doesn't give the error close, and now what you will see is that we only have the land use land cover in the catchment, so I can copy the style, there it is, and let's check the attribute table, and what we see there is all the columns, we find the catchment area, and we find the idea of the catchment and the level 1 classification, so what we now need to do is to add a column for the area of the class in each catchment, so for each feature now that we have intersected, we want to know the area, so I add another column in a similar way as we did before, and I call this class area, decimal length, let's make it again 10 with 2 decimals, and what we do there is class area equals, and now it's dollar area again, but now it is of the classes within the catchment, the intersected ones, and I update, and there we get the values, and now the final step is to take the proportion and calculate the percentage, so we can call this one percentage, and we can do that with 1 decimal or 2 decimals, then let's make it 4 and 1 decimal, and there I can say percentage equals, and then we can make the equation better to do it in the editor, where we say that is the class area, that is a bracket, the class area divided by the catchment area times 100, and here you see already a result for one class, as an example, do okay, and we do update all, and here you see the percentages of each class, so if I select this one, big one, that is 58.1% of this catchment consists of that class, we shouldn't forget to save this whole file, so now we can further process this in Excel to make pie charts for example.