 Hello, this is Hans van der Krost, Senior Lecturer at IHG Delft Institute for Water Education. In this video I'm going to show you how to use zonal statistics in QGIS. We'll first look at how to use a polygon layer with zones to extract the statistics from a raster. In the second part we'll look at two raster layers, one continuous and one discrete which has the zones to extract the statistics of the continuous raster layer. In the lower left of the QGIS window you can find the search box where you can search for tools. If I type zonal a lot of tools will pop up. We're going to use the zonal statistics tool. If you click on it it will open the tool but you can also find the tool from the processing tool box where you can also search. Let's start the zonal statistics tool and as an input layer I use polygons of subcatchments and as a raster layer I use the DEM because I want to calculate statistics per subcatchment. I can define an output column prefix but I leave it as default and I can choose the statistics that I want to calculate and I want the mean, the standard deviation, the minimum elevation and the maximum elevation per polygon. Then I save the output file. Let me use shapefile here and then I click run. And we get an error which is related to the geometry of the polygons. These polygons have been derived from raster and therefore there are geometric errors that we can easily fix. I'm going to show you in the next step. In the processing tool box search for fixed geometries. This tool will solve our problem and I save it to a new file. Let's call it subcatchments fixed and then I run it and it's our fixed layer. I can simply copy the style, paste it to our new fixed layer and remove the old one not to get confused. And let's do the zonal statistics again and see if that solved the issue. Fill it in the same way as we did before to get the mean, standard deviation, minimum and maximum elevation per polygon. Save the file. Call it subcatchment elevation fixed and I run it. There it is. It creates a copy of the layer but then with the statistics added to it. Let's paste the styles and look at the attribute table. And here we see that mean, standard deviation, minimum and maximum elevation are added to this attribute table. And you see that it starts with an underscore but you could have changed the prefix to change the names of these fields. Now we'll look at the second method where we have two ruster layers. One ruster layer with zones and one DEM. So I use the ruster layer zonal statistics tool and I change the input layer to DEM and the zones layer is ruster zones. It's a discrete ruster with integers that indicate the different zones. And under advanced parameters I can choose the reference layer. That means the layer that will be used to calculate the centroids for the values. It can be the input layer or the zones layer. And if there is no data in any of those layers it will be skipped in the statistics. I give it an output name, ruster zone output and then I run it. And it gives an error because the output is not a shapefile but a dbf. If I look at my browser panel I see that the dbf is created and I can drag it to the map canvas. And there I see it as a table and I can check the attribute table. And there I see the calculated statistics. So in this video you've seen two ways of doing zonal statistics. One method using polygons for which we want to calculate statistics of a ruster layer, a DEM, in our example. And the second method is where we have two ruster layers, one discrete ruster layer with zones and another one from which we want to calculate the statistics, in our case the DEM. It should be noted that the ruster layer zone of statistics has a limited amount of statistics that are calculated and cannot be controlled by the user yet.