QGIS/C2/Raster-Data-Styling/English-timed
From Script | Spoken-Tutorial
Time | Narration |
00:01 | Welcome to this tutorial on Raster Data Styling in QGIS. |
00:07 | In this tutorial, we will learn, to style a continuous raster. |
00:13 | To write an expression in Raster Calculator. |
00:17 | About raster properties. |
00:20 | To record this tutorial, I am using,
Ubuntu Linux OS version 16.04 |
00:28 | QGIS version 2.18 |
00:32 | To follow this tutorial you should be familiar with QGIS interface. |
00:38 | For the prerequisite tutorials please visit our website. |
00:43 | Download the folder given in the Code files link, located below the player. |
00:49 | Extract the contents of the downloaded zip file and save it in a folder. |
00:56 | Here is my Code files folder. |
00:59 | Double-click to open the folder. |
01:02 | In this folder you will find Population Density grid files for the entire world, for the year 2000 and 1990. |
01:12 | There are two files in ASCII format, with .asc file extension. |
01:20 | Let us open these files in QGIS. |
01:24 | Close the Code files folder. |
01:27 | Here I have opened QGIS interface.
Click on Layer menu. |
01:34 | From the drop-down select Add Layer. |
01:38 | From the sub-menu, select Add Raster Layer. |
01:43 | A dialog-box opens. I will navigate to the Code file folder on the Desktop. |
01:52 | Select the two files with .asc file extension. |
01:58 | Press and hold the Ctrl key, click on both the files. |
02:04 | Click on Open button. |
02:07 | Coordinate Reference System Selector opens. |
02:11 | In some settings, CRS will be selected automatically. |
02:17 | In such a situation this window may not open. |
02:21 | If Coordinate Reference System Selector does not open, ignore this step and proceed with the next step. |
02:30 | Here I will select WGS 84 EPSG 4326 from the list. |
02:39 | Click on OK button. |
02:42 | Since we are adding two layers at the same time, Coordinate Reference System Selector opens once more here. |
02:51 | Again select WGS 84 EPSG 4326. |
02:58 | Click on OK button. |
03:01 | On the canvas you will see a world map rendered in grayscale. |
03:07 | Lighter pixels indicate higher population and darker pixels indicate lower population. |
03:15 | In the Layers Panel, you will see both the raster layers loaded. |
03:21 | Each pixel in the raster has a value of population density for that grid. |
03:27 | To see the value of the pixel, click on Identify Features tool on the top-right corner of the toolbar. |
03:35 | Use the mouse wheel to zoom in the map. |
03:38 | Click anywhere on the raster map. |
03:41 | The pixel value will be displayed in the Identify Results panel. |
03:48 | Observe that the lighter pixel has higher value and the darker pixel has lower value. |
03:57 | Close the Identify Results panel. |
04:00 | Zoom out the map. Click on Pan Map tool and adjust the map on the canvas. |
04:09 | Population density pattern can be better visualized with an appropriate type of styling. |
04:16 | Right-click on the 1st layer in the Layers Panel. |
04:21 | From the context menu select Properties option. |
04:26 | Layer Properties dialog-box opens. |
04:30 | In the dialog-box select Style tab. |
04:35 | Under Band Rendering section, change the Render type to Singleband pseudocolor. |
04:42 | Let the Interpolation be Linear. |
04:46 | In the Color drop-down, select Spectral. |
04:51 | Scroll down. |
04:54 | Select Mode as Continuous.
Click on Classify button. |
05:00 | You will see 5 new color values created. |
05:05 | Click on Apply button and OK button at the bottom right corner of the dialog-box. |
05:14 | Back in the QGIS Canvas, you will see the raster map displayed in 5 classes of spectral color rendering. |
05:24 | Follow the same steps as shown for 1st layer and change the raster style for 2nd layer. |
05:45 | For our analysis, we would like to find areas with largest population change between years 1990 and 2000. |
05:54 | For this, we need to find the difference between each grid’s pixel values in both the layers. |
06:02 | For these calculations, we will use Raster Calculator tool. |
06:07 | Click on Raster menu from the menu bar.
From the drop-down, click on Raster calculator. |
06:16 | Raster Calculator dialog-box opens. |
06:20 | In the Raster bands section, the names of the bands are displayed. |
06:26 | Since each of our rasters have only 1 band, you will see only 1 entry per raster. |
06:33 | The raster calculator can apply mathematical operations on the raster pixels. |
06:40 | In this case we want to enter a simple formula to subtract the population density for the year 1990
from the population density for the year 2000. |
06:52 | Under Raster bands section, select the layer by double-clicking on the raster layer for the year 2000. |
07:00 | The expression is now added to the Raster calculator expression section. |
07:06 | From the Operators section, click on subtraction operator button. |
07:12 | Again from the Raster bands section, double-click on raster layer for the year 1990. |
07:20 | The formula for the calculation is now displayed in the Raster calculator expression section. |
07:27 | Under Result Layer section, you will see Output layer box. |
07:33 | In the box, type the name of your output layer as pop-change.tif. |
07:41 | In the Output format drop-down, select Geo TIFF. |
07:47 | Output CRS option is automatically selected. Leave it as such. |
07:54 | Check the box next to Add result to project. |
08:00 | Click on OK button at the bottom of the dialog-box. |
08:04 | You will see the new layer load in Layers Panel. |
08:08 | To view the map for the 3rd layer, in the Layers Panel uncheck the check boxes for pop-2000 and pop-1990 layers. |
08:21 | We can create a much more informative map by changing the style of this layer. |
08:27 | Right-click on the pop-change layer.
From the context menu, select Properties option. |
08:36 | Layer Properties dialog-box opens. |
08:40 | We want to style the layer such that, pixel values in certain ranges get the same color. |
08:47 | Click on Metadata tab, scroll down to Properties section. |
08:55 | Note the maximum and minimum values. |
08:59 | Maximum value is close to 6000. |
09:02 | Minimum value is just above -2000. |
09:06 | Go to the Style tab.
Under Band Rendering, select Singleband pseudocolor as the Render type. |
09:14 | Set the Interpolation to Discrete. |
09:19 | Scroll down.
Locate Add Values Manually button. |
09:25 | This is a green plus symbol button located next to Classify button. |
09:31 | Click the Add Values Manually button 4 times to create 4 unique classes. |
09:39 | These values show-up in the middle panel. |
09:43 | Here we have to change the values in each row. |
09:47 | Population values lower than the value entered, will be given the color of that entry. |
09:54 | Double-click on the first entry in the Values column to change the value. |
10:00 | We have observed, the minimum value in our metadata analysis is just above -2000.
Type -2000 in the first entry. |
10:12 | Double-click on the color-box and change the color. |
10:20 | Double-click on the Label column in the first row.
Type, No Data values. |
10:28 | Similarly fill in all the values and labels as shown here. |
10:33 | In the 2nd row, -10 to denote Negative change. |
10:46 | In the 3rd row, 10 to denote Neutral. |
10:59 | Finally 6000 to denote Positive change. |
11:03 | Because our maximum value from the meta data analysis is close to 6000. |
11:23 | At the bottom-right corner of the window, click on Apply button and then OK button. |
11:30 | Now on the canvas you will see a much more powerful visualization of the population data. |
11:37 | Here you can see clearly areas which has seen positive and negative population density changes. |
11:46 | Areas colored in blue denote the positive population change. |
11:52 | Areas in green show negative change. |
11:56 | Areas in pink have not see too much population change. |
12:02 | Let us summarize, |
12:04 | In this tutorial we have learnt,
to style a continuous raster, to write an expression in raster calculator, About raster properties. |
12:17 | As an assignment
Using the population data given in the Code files link, Create a new raster file which shows only negative population change. |
12:28 | Hint: Use Raster Calculator, write an expression to select population change less than 0. |
12:36 | Your completed assignment should look as shown here. |
12:41 | The video at the following link summarises the spoken tutorial project. Please download and watch it. |
12:49 | The spoken tutorial project team conducts workshops and gives certificates on passing online tests
For more details please write to us. |
13:00 | Please post your timed queries on this forum. |
13:04 | The Spoken Tutorial Project is funded by NMEICT, MHRD Government of India.
More information on this mission is available at the following link. |
13:16 | This tutorial is contributed by Prajwal.M from NIT Surathkal and Snehalatha from IIT Bombay.
Thank you for watching. |