[MUSIC] Hello again, and welcome back. In this lesson, I'm going to show you resampling rasters, which is the process of taking a roster at one resolution and turning it into a roster at another resolution. This is a generic concept that's common to all raster data types, not just in GIS, but to photos as well. But there are a few GIS specific considerations we'll need as well as some tools that are involved such as the resample tool. So to demonstrate, first, we're looking at a land use raster, and we're specifically looking at the Denver Colorado area in the United States, and if I expand this I could see the different land use types, and I'd need to go look at the metadata to see what each of these values means, but in this case that's not super important. What is important, is that this is a historic land use raster, representing what Denver probably looked like in the 1950s. And red, I know, is urban, and blue i know is water, and the other types are various different land use types. Now, I want to compare this raster to the modern land use raster data sets for the United States, and those are 30 meter resolution. But if I take a look at a pixel, here, to see what the distance is. And I can look at the properties, too, but let's just measure it. I can see that it's about 250 meters of resolution here. So I'm trying to compare a 250 meter resolution raster to a 30 meter resolution raster. And to match these one to one, I really need to resample one of them to the other in order to make them directly comparable. Now, before we make the match, what I want to do is show you what happens if I just re-sample it in general. As we've said before, if we increase the resolution on something like this, we don't really create new data. What we do is we make a data set that acts like it has a higher specificity than it really does, so we need to be careful about that. Our new data set won't be accurate to a higher resolution. And in fact, it might be slightly less accurate than this one, but we can still match to something at that resolution. Let's take a look to see what I mean. So let's start off by using the resample tool. If I can find it. So it's in the Data management tools toolbox, under the raster tool set. And then, in the roster processing tool set there's a resample tool. And it's a relatively simple tool. I provide the roster I want to resample and an output raster. And then, I need to specify a new cell size. And then, the method for determining which cells belong to which new cells. Or how do we map cells to new cells? So in this case, let's say I want to do a 40 by 40 roster. The land use data is at 30 by 30 but we'll do 40 by 40 first. And I specifically want to try 40 by 40 because it's not a particularly good choice for resampling, at least it's not a careful choice. There may be reasons to do it anyway, but 40 doesn't divide evenly into 250, and so we're going to see some cell boundary shifts. And that's where our resampling technique really starts to matter. So let's take a look at what goes on with each of these resampling techniques. First is the nearest neighbor resampling method which basically for each new pixel finds the closest other pixel in the previous data set and assigns the value of that to it. It, as it says, minimizes changes to pixel values which can be really good when you're doing any sort of changes to rasters because you keep the data as true as possible to the original data. For continuous data, sometimes you really actually don't want to do something like nearest neighbor. Like with a digital elevation model, nearest neighbor can result in things like stair-stepping. And you still have to be careful with bilinear and cubic because they, again, kind of create specificity that's not really there in the data. But at the very least, they do minimize some of that stair stepping in your elevation model that would occur with nearest neighbor. So bilinear interpolation, as it says, calculates the value of each pixel by waiting based on the distance from the cell centers, the surrounding 4 pixel values. Cubic convolution is a little more complicated and uses a curve fit through the 16 surrounding pixels. And then, there's majority which is really simple and suitable for discrete data like gland use data we're looking at, that determines based on the most popular value in a nearby window of 3 by 3 pixels. For now, to keep our modifications to our data as minimal as possible, let's use nearest neighbor default here. And I'm going to click OK to run it. And its going to resample this raster to 40 by 40 from the 250 and return a new raster to my table of contents. And I don't know if you saw that, but there was a slight shift in the visual of the cells there as it got added. Let's take a quick look of that. To do that, let's bring up our image analysis window and then collapse our toolbox, and select our top layer here, and use our swipe tool that we've learned about. And it's subtle but there are minor shifts in the cell boundaries, I don't know if you can see that very well in the video or not. But you can see the cells are slightly different, like right here under my cursor, there's the different edge to the raster as I move up and down. And it seems almost like it's making it a little bigger, and maybe that's in order to get the cell values, it's combining 40 by 40 cells until you get a slightly bigger area for a lot of it. And with the newer one on top, the 40 by 40 on top, let's take a look at what happens with the pixel inspector. Then, we can see that what used to look like one cell, is now multiple cells. And in fact, we're getting a slight lopsidedness based upon our choices here which is that this pixel in here, which used to be 1 cell, is now a grid of 6 by 7 cells. So now it's slightly taller than it was, or than it is wide. And if we turn that off, we can see that it was square in here, but in order to fit into this new resampled raster, it's going to change the shape. These are all really minimal, and in fact, it did a pretty good job of preserving the data. But what we'll see is that these resampling techniques matter a lot more when it comes to reprojecting our rasters, which I'll show you in the next video. And also to how we assign cells in things like zonal statistics. How does a zone determine which cells fall inside it? Is it something like nearest neighbor, is it the majority of cells, is it cells whose cell center falls inside of it? These are the implications of things like resampling. Just a few other things to mention before we wrap this up. First is that if I really wanted to make this match the newer land use raster that I have, the current one, as I was talking about, probably what I'd do when running this is I'd take my original here. And I'd set the cell size to 30 by 30 which I know is the cell size of the new one. And then I'd set my environment variables and Under Processing Extent, I would set the snap raster. And the snap raster environment, we'll talk a little more later in this course. But I would find my newer raster on my disk and choose that to be the snap raster environment variable. What that does is it makes sure that the cells, that are output from this tool, align with the cells in the snap raster. So you get perfect alignment. In order to do that, you need to choose a cell size that is divisible by or multiple of the snap raster that you're choosing. So in choosing 30 by 30 to snap to a 30 by 30 raster we're fine. But it's a great way to make sure that the two rosters align so you don't end up with more pixel alignment issues after you resample. So you should do that at this step here, set your snap raster. And the last thing I want to mention is that we don't have to resample downward. We can resample upward. Let's say to 1,000 by 1,000. Let's make kilometer pixels. Maybe we want a more course dataset to match for a larger analysis or something like that. So I could take this 1950 land use and make it much a larger raster datas, or a much larger set of cell sizes. If I click OK and I'll turn off the other one in the meantime. And now we can really see the implications of the re-sampling here. If I did some different choices I might have gotten different cells in here. So let's do that swipe again, and take a look at what's underneath it. And if I swipe now, I can see that It's not always obvious to me which one's it's choosing. Sometimes it seems like it should've chosen yellow when it chose red, and my resampling choices might really matter here. I ended up getting water in here even though that water is only two of the many cells that were part of this. So I might play with my resampling method, maybe I'd try choosing majority instead. So lets take a quick look at what happens if I choose majority now. So if I chose and make kilometer pixels, and then choose majority, we'll get a new resampling. That looks quite different from the old one. So let's swipe on that now. And I have very different cells here. So the choice of nearest neighbor versus majority, which is, choice of choosing the cells that are nearest to the new cell, versus the cells that most make up the contents of the new cell, really matters in this choice. And it also matters when you're down scaling but there's slightly different considerations for each. That's it for this lecture. In this lecture, I showed you how to use the resampling tool to change resolutions of your raster. I also talked about the implications of different choices for cell assignment. In the next lecture, we're going to take a look at how that factors in when we reproject rasters, which is a really, potentially lossy operation where we can lose a lot of data. So we should be really careful with it, because of how resampling factors in. See you there.