 Welcome to NPTEL course on remote sensing and GIS for rural development. This is week 4 lecture sorry week 5 lecture 4. In this week we are going to look at raster data sets and the past lectures we have looked at the different types of data and how raster is different from vector and where raster data can be used for rural development. In addition we also looked at the aspects where raster data can be used and lot of errors and issues that can creep into the raster data set. These can be effectively removed through the system by using GIS tools and algorithms to filter the data. Given that let us look at some tools for raster analysis in today's lecture. So as we have seen in the GIS portal and the GIS dashboard there are lot of data sets available which are raster that can be used for learning. But most importantly there are set of raster tools that are always on the toolbar. This is what we will look first in today's lecture. We also looked at how do you understand the tool by using the help bar. We will also showcase each tool which is dominant for rural development cases of the tools that are listed today. So if you see here in the raster window you do see that there are lot of tools and in the tools we have multiple analysis tools, projection tools, miscellaneous tools but not all are priority level high in rural development. We will only focus on certain tools that will be used in the following case studies. Let us look at some of the tools today. But before that please spend some time using the software going through the help command as I showed you in the previous lecture and studying about each tool. Normally one tool can be discussed in one lecture but we will go through four tools because I have given you how to read and assess these tool sets. The first tool we will be looking at is the raster calculator. Before that I will again show you how to look at the tool bar. So you have the GIS open blank window, an empty project and in that project you have raster. Just click on the raster tool bar on the top and then if you come down there are multiple data sets. And these data sets are important for tool sets. These tool sets are important for our particular rural development cases of which we will look at some specific cases in the later sections. Here what you see here is and as an example we can click one and then the help command I have shown how to use the help command. So this is where you will be using. There is a database manager if you have a database and then there are a lot of data sets that you use and using the add raster layer button. So the add raster layer button is also on the tool bar. It is below the main tool bar and it can add rasters, add mesh layer or even create new raster sets. What we will be doing now is let us go one by one in today's lecture and see some of the data sets, tool sets that we will be using. So let us go back to the presentation window that we have wherein we have the PowerPoint presentation. The first data tool set is the raster calculator. As the name suggests this is a calculator that is used to calculate using raster as an object. So in a normal calculator what do you use? You use numbers. So 5 plus 4 is equal to 9. Here 5 is an object, 4 is an object, plus is an operator. You use the operator and then you make the result. In a raster calculator instead of numbers you use the raster itself. So a raster plus b raster is equal to c raster. The plus is the operator. As you could see here there is a column of operators, the pointer. So you can see that there is a lot of operators and you have the bands that can come in here. You can add, subtract each band as needed. I will not show examples because that takes time to run and stuff. We will just introduce the tools. We will have a hands-on tool display in the following lectures. So what does this tool do? So before that a small hint for those who are learning softwares. You can use a book or a tutorial to learn software by keying in specific steps. You can also learn it by just playing with the software like just adding two layers, subtracting two layers, etc. These are not coded heavily. You already have the codes embedded in the system. All you have to do is bring the objects, use the operators and then get the output. The output can be stored in the computer or you could store it as a fly data on your model. So let us look at the first aspect. The raster calculator it is in the raster menu as you could see and allows you to perform calculations on the basis of existing raster pixel values. So when I said a plus b is equal to c, let us draw this function. So a raster is having four pixels, let us say values are 1, 2, 3 and 4, whereas your b raster can have, have changed the color. So let us change it to orange, assuming these are all equal size and this is 2, 1, 4 and 3. Any values can be there, we are just using it and the operator is plus. So now what will happen is the resultant pixel value would be only calculated based on the same pixel location, for example 1 and 2 are in the same location. So 1 plus 2 is 3, so this will take 3, 2 plus 1 is 3, 3 plus 4 is 7 and 4 plus 3 is 7. So now we have added two layers based on the numbers that are interchanged and but in a pixel which is same as the other pixel. So two layers are there, this pixel and this pixel are the same location but different values and the values we are adding. So the resultant is what comes here in the output layer and the format is geotiff. So the two layers can come here and you have an operator which is plus. The operators can be complex by using equations such as a plus b plus c is equal to d, okay. So we do not have to keep it simple, we can also make it complex by putting in brackets, divisions, multiplications, anything, right. So please understand that depending on the model and the dataset that you use, you can have it much complex or very simple formula. And also the value of the pixel need not be just multiplied with another pixel, you can have one common value denominator applied across, okay. So for example, in the previous model you had, let me draw it again, a different example. In this box you have 1, 2, 3, 4. So in this raster you had 4 pixels, values 1, 2, 3, 4. Now this can also be multiplied by a common denominator which is 3. Any value can be used, okay. So just example I am giving. So the resultant would be 3 times 1 is 3, 2 times 3 is 6, 3 times 3 is 9, 4 times 3 is 12. So now you could see that a simple raster calculator can be used to multiply rasters between the rasters or just one common value and multiply the rasters. Where this will be important, that is in rural development cases, we will discuss that in the case study scenario. So moving on, these are just the introduction of the raster tools. Then we have an example given in the manual itself, convert elevation values from meters to feet. We know that from meters to feet we need to multiply it by 3.28. So the equation that comes in the raster calculator equation box is elevation which is the raster band times 3.28. The elevation at 1 is the raster name, the name of the raster, that times 3.28 gives you the meters to feet conversion, okay. So this is very, very important for doing multiple values and changing the values into different, different aspects. Because what happens is normally we get data in a particular unit. As I said in the initial part of the rural development cases, we will get in a different different units. However, we will have to make it in a same scenario. And that same scenario is only possible if we use, excuse me. If we use a particular unit, okay. So the unit is important, right. And we will have to apply the same unit across. We cannot, we cannot have multiple different units and then crash the model. You need to have the unit and that normalization happens by multiplying a common value to convert one unit to the other. All units can be made as a same unit by using arithmetic operations, okay. Good. So moving on, we will now look at how the tool is in the GIS portal. Let me open it. Okay. So we are here. In the GIS portal, we can definitely open the raster calculator. As I said, the raster bands, the input bands would come here. You can create the on the fly of the raster or you can do output layer where you want to store. All these were discussed in the previous class. And if you need a help, just click the help bar, it will go into a new tab which will open now. See where it's opening, okay. And I have to share, okay. So now you could see that the raster calculator help tool has come up and you can use it along where you will have to. So they also give you some data to play with and examples using a mask, how you can do classifying a raster, the multiple, multiple aspects, algorithms that you can use. And the forum will help you definitely for understanding where the raster is, okay. So moving on, let's go back to our presentation. So the next tool we'll be looking at today is the raster alignment, okay. What is what is special about this? So you could see that it looks like raster layers to align. So you may have different rasters present in the data format or for your rural development objective. Let's say you're doing an agricultural-based assessment. You need rainfall, soil type, crop type, groundwater levels, et cetera, as rasters. So all need to be aligned. So what do you mean aligned is, each one could be in a different projection. So let's first define what we are going to do in the raster alignment. Merge several rasters as input and align them perfectly. So one raster could be here, one raster could be here because this is using a different coordinate system and a reference system. And if you bring it together, this is this. For example, if for this, this is a zero. For this raster, this is a zero. We're going to merge the zeros together and then align them so that all rasters can be used for the same location. Re-project to the same coordinate reference system, CRS. Because as I said, a satellite can take in a different coordinate system. It need not coincide with the same coordinate system that this satellite is using. Then re-sample to the same cell size and offset in the grid. Each raster has a pixel value, there is a value, but I also said there is a spatial resolution. For example, this raster raster one has a cell size of 100 by 100 kilometer, like Grace, whereas the Landsat data can have a 30 by 30 meter resolution. How do you merge them? How do you bring them to the same panel? That is by doing re-sampling. Okay. Re-sample is a good tool for rural development where you have multiple data sets in different cell size, but you can bring them to a same level, same cell size by using the align tool. So you could see here, there is a button called CRS. What do you want to do with the layer? That's what it's asking. Let me bring my pointer. So it says you put all the input layers here. Then what you do is you can create a reference layer or you can say that bring them all to the same CRS, wherein they are scattered. Now bring them all to the same coordinate reference system so that they can align each other. For example, Chennai here in one coordinate system is far away or compared to another coordinate system. Or the size of Chennai is different here and there because of the coordinate reference system. However, we know in reality there's only one Chennai location. So for that Chennai location, you're going to bring all the layers together so that they merge. Once they merge, you can do calculations on them. So the raster calculator can come after you align the rasters. So the first part here is you will be looking at resample to the sample, same size, cell size and offset in the grid. So here's where you have the cell size and grid offset. So the cell size is very important. You can give a numeric value for the cell size for the x and y so that you have the same cell size across. You can also do a clip to a region of interest. Let's say for example, you are downloading data, the data I download is for the India scale. You cannot download the India scale or use the India study scale for a small district. Let's say Pune. So for Pune, you need to remove all the other data which is too heavy on the system and on the database and only use the Pune district data. So for that, you need to clip. Clip is a tool that we're going to see where you have the entire data set, but you only take one data set that you want for the region and the others are thrown away. Though those are discarded because we don't want to use them. We're not going to use them. So just use a clip to a region of interest. Rescale values when required, as we showed in the previous example, suppose one is in a different unit and the other is in a different unit, you can rescale. So you know how the cell size can be changed. If the cell size can be changed, you can also scale up and down the values when required. So kind of multiplying with one on the other. So let's look at how this tool is on the platform. So you can see here, I'm going to close this, use raster, and then where do you find it? It's here. You don't have a thumbnail like you have for raster calculator and geo-referencer, but we'll use it. Geo-referencer is very important. We will use it extensively in one week. I'll show you why it's very important for rural development, especially the maps are outdated. We will update those maps. So aligned raster is this. You can add data, subtract the data based on your interest. Since we don't have any layers here, it is not showing as positive. But once you add it, then it will auto-populate with the raster image. So what happens here is you have an opportunity to look at different datasets and make them in a same singular fashion. This is important because sometimes what happens is we tend to have only one estimate of the data. We don't use multiple datasets or we don't see multiple datasets for a single property. Let's say groundwater. We only look at groundwater. However, we know that groundwater can be a function of rainfall, land use, crop type, etc. So in that case, what we have to do is we'll have to merge some understanding from the other datasets so that we have an overall picture. So let's see in general terms how a dataset can look like in a real-time world. So I'm going to share the screen with some data that I have downloaded. You can see here that there is a dataset for, I just added these data. So you have timelines. We can remove that, right click, remove that layer. And then you have soil moisture. So basically what layers have I added? I've added soil moisture from 0 to 10 centimeters, 10 to 40 centimeters, 100 to 200 centimeters, and then there's another 40 to 100. So 40 to 100 comes here. So basically from 0 to 200 centimeters, you can assess the soil moisture. Why is this important? When you're growing crops, you need to understand how much water is there in the soil. If the soil level is less, water level is less, you will have to supply more water. So it is very important for agricultural water management, rural infrastructures to know what is the status of soil moisture. So we'd also remove the other layers for now. Let's just keep these layers. And as I said, let's first look at the last calculator. I'm going to say that I'm going to add. I need the net soil moisture, which is available across the region. Let's zoom in. So I'm going to zoom in to Tamil Nadu region. You can relabel it as 0, 1, 2, 3. Let's do that so that we can have quickly 1, 1 underscore, 0 to 10. And then we have 10 to 40. Then we have 10 to 40. And then we have 40 to 100. And then let's pull it up. 1, 2, 3, and then 4. Just for our additions, I'm going to show. So now all these layers are there. As anyone who knows GIS have been using, you know that the top layer is what is visible. If you remove it with the coloring changes, if you remove it again and again, so all the maps are gone. So I can have all the layers turned on. And I have clicked the raster calculator. For the first example, let us 1, 2, 3, 4 is there. So I'm going to click 1. So 1, if I double click, it populates the raster calculation expression. Then I said I'm going to add. I'm going to add to show that the output layer is going to be called soil moisture. Always use underscores for names. Space is not a good way of naming in GIS. 0, 2, 400 centimeters, 200 centimeters. Use selected layer, extend. So this is the whole globe. So let us use the whole globe. You could see I'm only focusing here, but we can remove that later. So number 1 plus 0 to 10 plus 10 to 20, 10 to 40. So I'm going to click and double click. It comes. So if you double click, the equation already comes. The variable comes in with the double quotations and stuff. So that name is big. That's why you see the whole name. Otherwise, you can just have a simple name for it. Then you're going to add again. So you're going to add, you can put 3. And then you're going to add again and save 4. So now you have 1, 2, 3, 4 plus. Is the expression valid? Yes, it says the expression is valid. The total soil moisture is 0 to 200 centimeters. And projection, don't worry about it now. You can keep the one which is there on the projection. Say OK, and it is populated. So how do we know how we have done? We can use this click button, the Identify button. And you can click one pixel, just one pixel. And that one pixel I clicked has a value. So that value is going to be extracted now in the right-hand corner. If you click the right-hand corner, you can see the values of band 1, which is what it is to say is 22 points. So the decimals just leave it for now. It's a long number. So 1, 2, 3, you have band is 159. And then 4 is 300. So 315, we're just going to do an average. 315, or we can use the calculator also. Let's use the calculator. OK, looks like my calculator is not coming on the screen, but I'll keep it on the side. So I'm just going to add 22 plus. The next value is 78 plus 159 plus 315. This is neglecting the decimals for now for time concentration. So it's around 574. Around 574 is the total. So what are we getting here? So this same pixel should have the same number. So exactly 574, 575, 576 is because of the decimals. So you see how we have summed four rasters into one. And now we have labeled it as 0 to 400 centimeters. So that is how you would be using the raster calculator. You can multiply, subtract, add, add variables, et cetera. So you could see visibly 22.7, 78.6, 159.7, 315.1. Add all of that. That is 576. Good. So let me remove the total moisture now. I don't want it. So let me remove it. So this is one tool that we have seen today. The other tool is the aligned rasters. And then as I said, you could align all of them into the same. Now if you click the plus button, you could see that, oh, OK, this can come. Do you want to rescale the values or just add the values? We just equal to add. So there you go. You got added. So just click on add. I want a second. So just input layer because input is already here. You can just click input layer. Number two, it will input. Number three, just go on do that for all the four. And then you can put that. So now the last layer is to align. Eventually, all are aligned in the same coordinate size. And the cell size is also going to be the same. How do you know? You can use the scale. So the scale tool is there. Just click and say, OK. Or add aligned passes to the canvas. So if it is already aligned, it cannot be aligned again. So cell size is also the same. But we're going to change the cell size to now it's 1.00. So let's say I'm going to change it to 0.5. Also can be done 0.5. So this is how you could click what you want to change. Or let's say I'm going to change all of them to a different coordinate system. So you can say different coordinate system. There are multiple coordinate systems. Let's say Larissa and say, OK. So all of this are going to be aligned to a different coordinate system. Add aligned passes to the map canvas. Because we have already settled them in our database. We are not copied. It's not going to be. So this is how you would use aligned rasters. You would bring it to your map. And then you would align them or change the cell size, et cetera. How do you know the cell size? As I said, you can use the scale button here. Click 1, click 2 you have in meters the value. As I said, it is 1 degree. So 1 degree is approximately 100 kilometers. So let's first set it in kilometers. You can zoom in to see the pixel. So this is the pixel. And it's approximately 100. We have to zoom and click on the correct box. Since I'm not doing that, you have 110, but it is 100. So all the pixels are 100 by 100 kilometers. So with this, I will go back to the slides on doing the projection. So we'll do the last tool for today, the mask tool. So what is the mask tool? The mask tool is you have an input. So I have showed you in the QGIS layer. The whole globe is there. But I'm going to only focus on India. How do I take only India out by using a mask tool? The mask tool will do a clip function. So you have a whole layer and then only a small cutter you'll use and take it out. And that shape, that shape you want is the mask. So you have the input layer A plus the mask layer, which is only B. It could be the mask could be raster. It could be a shape file or anything. And then the tool, what the tool will do, it will take only the output under the mask and bring it out, thereby reducing the size of the data and the complexities associated. Let's look at an example. This whole raster is there, but I just want to look at this raster. So I'm going to apply a shape file. The mask shape file is red in color. It could be a raster or it could be a vector. Here it is a vector. It is a shape file. It is a polygon. So the polygon is applied on the top, extracted and put out. So then you have the output. So how do you make a mask? That is a vector shape file that you could use. And the vector shape files, you can create a new shape file to extract the region that you want. So normally I would create a new shape file and then draw on the shape file so that I could make a mask and then take it out. It's like making a cookie. So you roll a dough. The dough is the input layer and then you have a cup to cut and take out the shape you want. So the cutting shape is done in a vector shape file database. So I would like you to go ahead and read some more of the documents on using the manual for raster analysis. We will look at this in the next lecture. With this I would conclude today's lecture. Thank you.