[MUSIC] Hello everyone and welcome back. In this lecture, I'm going to show you how to use focal statistics, a tool in ArcGIS that we can use to analyze the neighborhood of a raster cells and write up new values based upon that neighborhood. In this lecture, I'll use it to smooth some values in a digital elevation model generated hillshade. And we'll do that as part of a larger model that generates a nice type of hillshade called a Swiss hillshade. So first thing, I turned of the land cover rustic because we're going to work with the digital elevation model that's in this map document from the previous lecture. And now I'm going to add a new toolbox here. I'll go to my trustee Add Toolbox area here and go find the toolbox that is part of this. And it's Hillshade tools 9.3 and I'll open it. And the 9.3 is because this toolbox is from ArcGIS 9.3 but it still works. At least the tool we're going to use does. And it's the Swiss hillshade model I'm looking at. And if I right-click and go to edit, we can take a look at the actual model itself. And, I know what's going on here because I've worked with this toolbox before. But let's kind of, I'm going to be you all who haven't seen this before and let's see if we can figure out what's going on here. So first, this is a relatively simple tool but it has some branching here. So, it's a nice showcase of what you can do in models where you have the same input going into two processes and eventually those come back to the same tool. In the first place I'd probably look, trying to figure out what's going on is this text down here. So it says, create a default hillshade. And then it's going to generalize the default hillshade using a median filter. This is the first of two required hillshades. And, given that it's same filtered and using the default hillshade, I'm assuming it's talking of this, focal statistics. And that's really what we're going to look at in this lecture, so it's generalizing the hillshade using a median filter. If that doesn't mean anything, it will soon. And then we're going to create a hillshade that simulates an aerial perspective by dividing the DEM by five. So we're going to kind of flatten everything and then we're going to add it to the default hillshade. And that will sort of merge the DEM and the hillshade together in a interesting way. And then, when we get the results of this, we actually end up stacking them all together in ArcMap. So, let's do this further to explore this by doing. So, what I want to do is I'm going to change the input DEM value from the default that it has to our trustee digital elevation model here. And everything is still ready to run, we'll use the default divide by value here five that it mentions here. And then the default z factor value that it has of one. And what I'm going to do here is I'm going to right-click on Focal Statistics and have it run that. And you make an error because of the scratch workspace if you're following along. And what we need to do is change the default hillshade's location here. So I'll double-click on it and it's trying to create a scratch workspace. I'm going to have it put it in a geodatabase for me. And you can choose any geodatabase you work with. And click OK. And now I should be able to run this. And it's running that hillshade. And once it done with the hillshade, I got the same error with the focal statistics where I need to tell it where I can put it into an actual geodatabase here. So I'll have it, but the filtered hillshade in here and click OK. And now I can run focal statistics. Okay, and now we have the hillshade and the filtered hillshade. And the filtered hillshade just added itself to map document. But let's first take a look at the default hillshade here. So I have that to display as well. Let's turn off the other two. And just zoom into an area here. It's a relatively flat hillshade and we have these kinds of striations across it maybe due to the DEM data or something else. And then, what happens if I look instead at the filtered hillshade results? At first, it looks like it made a big change. But if we look at the properties I can see that the stretch on the default hillshade is min max and the stretch on the filtered hillshade is standard deviations. So, to view them similarly, let's change it to minimum, maximum as well and click OK. All of a sudden, not so different. And let's zoom in a little more. And turn this on and off. And what it looks like is maybe the filtered hillshade, which was the one that went through the focal statistics operation. So we have our default hillshade and then focal statistics in our filtered hillshade. The filtered hillshade is just a little smoother in a way. And well, why would that be? Well, let's look at what focal statistics does. So, it says it calculates for each input cell location a statistic of the values within a specified neighborhood around it. What is that even mean? What that means is it goes through each cell on the raster and it looks at cells within a neighborhood which you can set here. So this is a four by four block on this one and so it's looking at 16 total cells including the cell involved. And it looks at the cells nearby and it calculates whatever statistic we specify here and replaces the cell it's looking at with that value. So it goes to each cell in the raster and finds the median of the 16 neighboring cells, four by four. And what that does is has a smoothing effect, right? If it's looking at window around it, we're going to have some kind of low values in here and some higher values. And if it's looking at the median, it's going to kind of find a value in between and smooth everything out a little bit. Well, that's not all it can do, it's actually pretty powerful tool. We can choose different statistics, so we can do mean or range and we can also have it look at different neighborhoods. So we can have a look at an annulus, which you can think of kind of as a donut or a taurus. And we could say that inner radius of cells that are excluded and then the outer radius for the cells that are included. We can also have a look at a circle or a triangular wedge or some sort of irregularly shaped object based on a file we provide. So, it's a pretty interesting tool to kind of take some data that's maybe noisy and smoothed out based upon some pattern or use you have for it. Okay, so that's focal statistics. Let's finish off this model so that you can see it in action and I'm just going to set these to that same geodatabase in the meantime. And then try to run this tool here. Oops, and it looks like the scratch workspace isn't defined, so I need just also put this in here. And now, I can run it. So, it's dividing the DEM by five right now. And then once it's done, it's going to add together the default hillshade and the divided DEM in order to create the area of perspective layer. And note the prerequisite here, the pre-condition here between the filtered hillshade and the plus. It's not saying that this feeds into plus. We're not adding all three together, we're just adding together to the default In the divided DEM, and then we're getting this filtered hillshade back and saying, it needs to finish before plus happens. And in the end, we'll have a DEM, a filtered hill shade, and an aerial perspective layer. And the other thing while these are running is divide and plus aren't anything super special. We could do that in raster calculator, just with saying DEM value divided by 5 but there's specific tools you can use as well as we've seen in the Spatial Analyst Toolbox. So, this divide and plus could both be replace by calls or raster calculator if you prefer, there's not a right way to do it. But, divide and plus using them directly makes it a little clear what's going on if you're looking at the model. Okay, and it's done and it's added them all to my map document here and so I'll close this and save it. And I'll turn off the default hillshade because what I need are the area of perspective, filtered hillshade and DEM layers and I need them in this order first was hillshade DEM, filtered hillshade and then area of perspective. And I'll going to put the DEM on top and make it about 55% transparent. And so we can kind of see that filtered hailshade below it, which is something we've done before. We've done hillshade and DEM combination with some transparency, so this isn't super different. Although, I'd say it looks a little different. There's a different sort of glow to it once we've filtered the hillshade. It kind of smooths everything out a bit across the landscape. And then, what we're going to do to make it even just slightly more, kind of have a bit more of a perspective to it is take the filtered hillshade and make it 35% transparent. So we see just a little peak of that areal perspective layer through everything. And we still get so much striation because of it but this is what we tend to call a Swiss hillshade and I think it has a lot more depth than the typical hillshades you've seen in these courses, and in your assignments, or just by default. So, it's a really nice way to build a hillshade and you can also still do some hypsometric tinting on the symbology so I can change the colors so that we have elevational banding on it, Such as this. And click OK. So you can do something like this with it as well, and get a layer like this, which is still just a little cleaner than when we've done this before, but I tend to still keep it grayscale or some scale of colors directly, rather than making it asymmetrically tinted. Okay, and that's it for this lecture. In this lecture, we looked at the focal statistics tool through the lens of a model that creates the Swiss hillshade for us. And, I think that the focal statistics tool is really useful. And you kind of, it's another one of those tools that you don't know you need it until you need something like it that looks the neighborhood and there is whole toolbox full of tools that analyze nearby cells. So we have focal statistics, point statistics, filter, and things like that. So they're worth taking a look at. And then we also learned how to create a Swiss hillshade, which I think is just a very subtly beautiful hillshade to put in the background of your maps. Okay, see you next time.