Zonal raster operators work on one zone at a time within a raster dataset. So in our example dataset here, we have three different zones. So cells with a value of one or in one zone, cells with a value of two or in a separate zone and the same for cells with a value of three. So we have three different zones. So, the difference with this as opposed to say a local or focal operator is that, with the zonal operator, the zone is defining where the calculation is done at a given time. So, let me show you how that works. So, each zone defines the calculation for the value layer. So, this is the zone layer. So, this is telling the software where to do the calculation on a value later. So, it takes two separate datasets in order to perform a zonal operation. We have the zones and we have the values. So, for example, if we told it to calculate a majority for the zones, what that's going to do, is look at the zone one let's say. So, this is zone one here, here and here and so, in the value dataset, it says, which of the cells are in zone one? So that will be this one, this one and this one. So, what's the majority cell value? In other words, which is the cell value that occurs most often and that would be the cell value of one. So in the output, you have one answer for that entire zone. There's only one majority for the zone. The majority value is one, so that value gets assigned to the entire zone. The same thing happens with zone two. So here we have the values that exist in zone two, which is the one that occurs most often, that would be the value three and so that's the answer for that zone is that three is the most common value, that's the majority, that's what he gets. Then the same thing for the third one. That's the zone. These are the values that are being considered for that zone, this is the answer for that zone. So it's a very useful tool to be able to use. It's great to be able to define these zones. These zones can be defined either using raster cell values or you can actually use vector polygons as well. So I'm going to use these vector polygons which are the official city of Toronto neighborhoods, to define the zones that I'm going to use to answer the question, which neighborhoods have lots of vegetation. So, to answer that, I'm going to use an NDVI value in order to determine or set of values to determine how much vegetation there is in each neighborhood. So the neighborhoods of the zones, the NDVI values are going to be used to do the calculations. Now, in order to do this, the way I would approach this is to say well, what's the majority cell value? What's the NDVI value that occurs most often in the neighborhood? And that might be a useful way of characterizing the amount of vegetation that exists in each neighborhood. But if I do that with the original NDVI values, you'll notice that those NDVI values are floating point or decimal values that in this case have six decimal places. So if you think about it for a second. If the software is trying to determine how many values are exactly the same in each neighborhood, in order to determine what the majority is, if we have values to six decimal places there will be no majority. In other words, it's probably likely that virtually every cell in that neighborhood will have a different value even if it's just slightly different. So that's how we are going to accomplish our goal. We're not going to be able to determine what the majority is if all the values are different. So this is a great situation or example where you can see the value of reclassifying and simplifying the data first in order to get a more useful answer. So if we zoom in a little bit here just to get a better look at it, we can do a reclassification and so I'm going to take the original cell values here, the floating point NDVI values and reclassify them into five classes. I'm just using an actual breaks here to make it simple and so, I'll have classes one, two, three, four, five where one is the least amount of vegetation, five is the most. So here's the data before I've reclassified and here's what it looks like after I've reclassified. So you can see, I hope that it's a simplified version of the data and that's what we need in order to be able to find a majority. So here's my neighborhoods again. Now I can perform my zonal statistics calculations. So I've got my neighborhoods as the input raster or feature zone data. So this is what's defining what the zones are going to be and this is important, is that in order for it to be able to tell the neighborhoods apart from one another, they each have to have a unique identifier of some kind. If all I did was have them all have the same name let's say they're all just said neighbourhood in the attribute table, then the software is not able to tell them apart from one another. It doesn't see them as separate zones. So there has to be some kind of a field or attribute that you can use to make them distinct from one another. So of course here they all have different names. So I'm just specifying the name column in order to tell it each neighborhood that has a different name should be a different zone. Input value raster is going to be the NDVI that I've reclassified. I'm going to create a new output called NDVI zone majority and the statistic that I'm telling it to use is majority for this. This is the one that makes the most sense for the best way I want to be able to answer the question. So there's our results. So that answers the question is that, for each of these neighborhoods we have one NDVI value, there's one answer, there's one majority value that exists for each one of these and so, I've used the same coloring scheme as the original NDVI values. So red is the least amount of vegetation, green is the most. So you can see neighborhoods where there's lots of vegetation here and I'm using this as a relative term, I was using natural breaks I can't say I'm doing this to any great level of precision, but it does give me a relative way of determining which neighborhoods have more vegetation versus less. We zoom in a bit here just to kind of double-check. This kind of makes sense to me, is that we have areas that are closer to downtown which have less vegetation versus an area like High Park which has more vegetation because a lot of that neighborhood is heavily vegetated. So I always like to double-check my results to make sure that I'm getting what I think and getting and sure enough I am. So I hope this is a useful way to kind of illustrate to you how zonal operations work and with a kind of realistic example.