[MUSIC] Hello again and welcome back. In this lesson, I'm going to talk to you about extraction of raster cells to new rasters. Specifically, using the extraction tool set in the spatial analyst toolbox. We'll take a look at the extract by mass tool in depth, and also do a quick overview of the other tools in that tool set. This is where we're really going to start illustrating the divide between raster tools and vector tools. Earlier in this class, you learned about how to clip polygons where we could take a polygon, and sort of use another one as a stencil to cut off parts of the polygon, and extract only the part we want. Well, we can't use the clip tool on raster data. There are fundamentally different algorithms underline that extraction process from polygons versus rasters. So, we need a whole separate tool set for raster data. This is really where the spacial analyst toolbox comes in. It's deigned to work on raster data, and some of the tools in there are standard toolbox tools that are meant for raster datam and others are totally new raster analysis tools. The extraction tool set in particular, is sort of like different versions of the clip tool, but for raster data. I want to point out three and then we're going to go in depth into one of these. But I want to point out, extract by attributes, extract by mass, and extract multi values to points. Each of these is a really great tool. And let's open up extract multi values to points, first. If spatial join takes polygons from one feature and attaches the attributes to another feature. And if the zonal stats summarizes raster cells and aggregates them to polygons. The extract multi values to points tool is sort of like the equivalent of that but for points, where it takes the values of raster cells and brings them as an attribute on point features. You can add multiple rasters here that you want to extract values from, and then have it go to point features as an attribute for each raster. It's a great tool, it's one to know about, and we're not going to go into it in more depth right now. But I want to point it out. And then the extract by attributes tool is great, because it's sort of like what we did in raster calculator before, where we can basically write a quick query against the raster. But if I say, Valmeyer DEM, or let's use Valmeyer slope. If I use do a where clause of value greater than ten, and Valmeyer slope greater than ten, as the name, and do okay. Start running. And where the raster calculator only gave us back whether or not the slope was greater than ten as a yes or no, as zero or one. The extract by attributes tool gives us back the original cell values instead. So if I turn this off, I can see that I still have those cell values, and I still have the gradient in the table of contents representing it. I just have null values where the condition was false. So instead of all these values being turned to ones and these others being zeroes, I actually have the original data extracted as a new raster. So, extract by attributes is a great way to write your own queries against your raster values. And get a new raster back with the original value, instead of with the map algebra or the raster calculator, having to then go do some other work. And just getting the yes or no answer. Each has its place, but this is the tool to know about. The other thing about this is that unlike the clip tool, we don't need a stencil first. Our stencil is our query in this case, and that's much more flexible. We don't have to outline the areas we're interested in. Instead, we can get a new area based upon the properties of the old raster, so that's a really powerful feature. But, going back to that sort of stencil approach, if I turn on the DEM again and let's zoom back out to it. What if I want to find or pull out all the raster cells within say, a kilometer of the boundary of Valmeyer. My first intuition might be that I'd want to use the extract by polygon tool. I have a polygon, don't I. But if I open it up, I'll see that it doesn't actually want a polygon feature class, instead I can provide X and Y coordinates to build a polygon that it would use to extract raster cells. That's potentially useful in another case, but not what I want. Instead, I want to extract by mask where the polygon is itself a mask. But first, in order to get the area within a kilometer, I need to buffer my Valmeyer boundary. So we'll go to the proximity tool set, and I'll go to buffer, and I'll select my Valmeyer boundary as my input features. And open one in kilometer, and I'll leave the rest of this as its defaults, and go to okay. So now, I have a much bigger polygon that I can use for extraction. And maybe this is my analysis area for a project, and so I want to really just clip out all my rasters. And get a set of data that's definitive and smaller, and portable that I can use to run all my analysis against. So, that's why I want to extract this information out of my raster. So, once I have that polygon, I'll go to extract my mask. And I'll select Valmeyer boundary or I'll select Valmeyer DEM as my input raster and Valmeyer boundary buffer as my mask data. And I'll do the name of valmejer DEM, one kilometer boundary. And I'll go to okay and once again, it's running in the bottom right corner, it runs pretty quickly, and if I turn off Valmeyer DEM. Or Valmeyer DEM and leave the new one on and turn off the boundary. I can see that it extracted the data from the data set for me, and I get no values around the edges. It also sets the full extent of this to the new cell, so if I zoom to it to see what the extent is. I can see that the extent actually only goes basically just into the closest rectangle around these cells possible. But then it fills in knolls and the areas that weren't masked by my polygon. One other thing to point out is that the masked features don't have to be a polygon. So let's say I now have my slope raster that we've used before. And I also want to extract the slope raster in the area of the boundary buffer that we have. Now, we know that I could use the same boundary buffer that I used before to extract the data from our slope raster. But just to show that it's flexible on whether we use raster or feature data as our mask, we'll use the raster that we just extracted, the one kilometer boundary here as out mask data. Valmeyer DEM, one kilometer boundary, and then for our input raster, we'll extract from the Valmeyer slope raster here. And I'll call it Valmeyer slope, one cam boundary. And I'll click, okay. And I'll turn off the slope and I'll turn off the raster here. And out of that process, we get the same slope raster that we had before, just within the boundary that we just clipped it using the raster that we had previously clipped out, using the extract by mask. We could've also used the Valmeyer slope greater than ten to do a further clipping on our DEM raster here. If we wanted to keep sub setting these things. So we could chain them together to do further and further extractions instead. So, extract by mask is a powerful clipping tool that you can use in conjunction with things like extract by attributes or any of these other extraction tools. In order to get exactly the raster cell you want for your analysis. That can be purely for a study area purpose or because you need to run different analysis on different portions of your raster. And you're going to divide it up into different areas for different types of analysis. Okay, that's it for this time. In this lecture, I showed you how to use the extractions tools in the spatial analyst tool box, to clip rasters. Specifically we looked at the extract by mask tool as well as a brief look at the extract attribute and extract multi values to points tools. These are really useful and I hope you enjoy them. See you next time.