[MUSIC] Hello again, and welcome back. In this lesson, I'm going to show you an example of resampling through reprojection of rasters. Now as I've said before, reprojecting rasters is a little different than projecting vector data because rasters are different than vector. With vector data, we can reproject the shapes without changing the attributes. But with raster data, the shapes are fixed as the raster cells. So, changing the shape through reprojection forces a change in the location of our attributes in the way that a vector doesn't. And that's something we need to take into consideration. This takes place through the process of resampling that I showed you last time, where when we basically realigned the cells, our data gets transferred to kind of a new location, or sometimes it picks up different data based upon how we resample the raster. So this comes out a lot in reprojected rasters. Now the reason this is a problem in reprojecting rasters is that projections can make our data display at different orientations relative to vertical and horizontal when we shift between different projections. The reorientation forces a resampling of the raster as I mentioned before, even though the cell size isn't changing in this case. So it still has to figure out which values get assigned to new values due to that shift in orientation from how each projection maps the world to its own Cartesian grid. It's a destructive process that should be avoided in most cases, except when necessary. So first off, this raster here that we used in the last lecture too is projected in an Albers conical projection that is optimized for all of the United States. Now that's totally fine, but let's see what happens when we shift its projection to something else. And a quick way to get a simple visibility into that is to just change the data frame projection to something else, because it will reproject our data in our data frame on the fly in the background to the new projection. So, let's see what happens when I swap the projection on the data frame to the NAD 83 Geographic Coordinate System. So when I do that, all of a sudden, my projection gets distorted and goes at a different angle. Now, it might look like it's just rotating everything to match the projection, which would be fine because that wouldn't really re-map the cells, right? If everything just got rotated perfectly in the raster, and the cells stayed the same and rotated, that'd be fine. But if we look at the edges in here, we can see, well, in the reprojection, it is rotated. In the data frame, it looks like everything's just nice and rotated. But it's not perfect. And here's how I can show you that. If I go to the layer properties and choose to display no data as a color like black and click OK, I can see that, in fact, it's not really rotating it, it's creating a new rectangular raster here that is fitting the minimum bounding rectangle around this. So we get the corners touching the top here and the sides here, and we have no data values all in here. And it looks, from the way it's reprojecting it, really smooth, but when we create a new raster, when we actually do a full reprojection, we'll see that there's little stair steps going on in here. Still, we get some different cell alignment here when we get this rotation, and I'll make that apparent in just a moment. So let's turn off our displaying at no data again. And let's set our data frame back to the way it was by choosing the layer, the Albers Conical Equal-Area Projection from the layer. So now our raster's back to its normal rectangle. But let's reproject the raster. So in the Data Management Tools > Projections and Transformations toolset > Raster toolset, there's a Project Raster tool. And let's select our input raster here. And we'll select the same output coordinate system we were just using, the NAD 1983 Geographic Coordinate System. Now, notice at the bottom here that the Project Raster tool understands that it's modifying your data, so it gives you the same resampling technique options that we saw before. We'll leave it at nearest neighbor again because that is a suitable option for things such as land use classification, as it mentions here. It also calculated a cell size that's appropriate for me based upon the translation in units. So the current one is in meters, and it's translating to decimal degrees since it's a geographic coordinate system, so it calculated the translation of those values for me. So let's make sure that it stays on nearest neighbor. And lets see what happens when I run this reprojection now. Initially, it doesn't look like a whole lot, but there is a little bit of a data shift if I turn this off and on. And let's turn on the no data values on our new layer here, so we can see that in fact, it is having a larger area here. And this is due to the fact that it's reprojected and then also that it's being reprojected again into this current data frame. So we reproject it to NAD 83, which forced that original bounding box around it and then it's being reprojected back to this, which fills it back into a rectangle. But we can confirm that it's larger and has those no data values because it has more rows and columns, so this has 830 columns and 482 rows. But the original one has 743 columns and 538 rows. So there are some changes going on to the data there. And then if I zoom in, let's zoom in up here. I can see this difference in orientation in the raster cells due to the reprojection. And I can also see that stair stepping I promised you, where at the top, it's not as smooth. And so I could see that this raster data actually has to slightly rotate and reorient. It's not just rotating the raster nicely, and we keep the top edge and everything's in line. We're actually creating a new raster that's fully stair stepped based upon our old data. And if I do a swipe now, like before, I can see some changes in the data, where I'm getting a whole different cell alignments over here. Like take a look at these yellow and green ones that were next to each other or next to each other, and the new one, but weren't before. And we're getting lots and lots of changes to our data if we look back between these two. Let's go down here a little more, where those are going on and do the same thing. There are lots and lots of little changes to the data if you look around, places where one cell becomes three or four, or three or four cells become one. And this is due to our resampling technique. And nearest neighbor is probably the best choice for this data, but we still have lots of changes. That's the destructiveness of reprojecting rasters. And that's why we want to be so careful about it, to only do it when we really need to. Now choosing not to reproject a raster, but then working with rasters in different projections isn't actually choosing not to reproject a raster. Because remember, a geoprocessing tool has to change data to the same projection in order to use it anyway. So it's going to reproject it in the background, and you're actually losing out on that choice by not reprojecting it. If you have data in different projections, it is smart to project it into one, so that you choose and get to validate that data. You choose the choices that go into that reprojection, and make sure that it's satisfactory to your analysis. Okay, there's just one last thing I want to show you about reprojecting rasters. And that's this, one more thing about the stair stepping, which is, if we take this raster that is in the NAD 83 projection, and we put it in a data frame that is in the same projection, so it's not being reprojected on the fly again. We'll see, okay, it's aligned north to south, which is what we'd expect, right? It's aligned north to south in its own projection, in its own coordinate system. But if I zoom out, that stair stepping at the top makes a lot more sense because what it's doing is it fit that other raster to this grid, and if we imagine that other raster's top edge running across here, it's running nearest neighbor and ends up assigning cells and then having to drop down a row and assigning more cells. And that's why we get the stair stepping when it's projected back into the other as well, is because it is taking this raster and rotating it to fit the other data frame, but it still isn't a perfect rectangle on the edges anymore. It is conceptually because it has no data values, but the data itself isn't a perfect rectangle anymore. Okay, that's it for this lecture. In this lecture, we applied resampling to the process of reprojecting rasters and saw that it is destructive to our data. It changes our data as we store it on our disk. And we have to take that into account when deciding when and how to reproject our rasters and what method we want to use to resample our data. This is a pretty important and fundamental concept, and you'll learn a lot more about projections and coordinate systems later on in this class. But for now, just remember that projections of rasters are destructive, and come back to this if you want to get a little more out of it after you take the section on projections and coordinate systems. Okay, see you next time.