Difference between revisions of "QGIS/C2/Raster-Data-Styling/English"
Snehalathak (Talk | contribs) |
Nancyvarkey (Talk | contribs) |
||
Line 28: | Line 28: | ||
|| To record this tutorial, I am using, | || To record this tutorial, I am using, | ||
− | '''Ubuntu Linux OS''' version 16.04 | + | *'''Ubuntu Linux OS''' version 16.04 |
− | '''QGIS''' version 2.18 | + | *'''QGIS''' version 2.18 |
|- | |- | ||
Line 38: | Line 38: | ||
− | '''https://spoken-tutorial.org | + | '''https://spoken-tutorial.org''' |
− | || To follow this tutorial you should be familiar with | + | || To follow this tutorial you should be familiar with '''QGIS interface'''. |
− | + | ||
− | + | ||
− | '''QGIS''' | + | |
Line 63: | Line 60: | ||
− | Double click to open the folder. | + | Double-click to open the folder. |
|- | |- | ||
Line 72: | Line 69: | ||
− | There are two files in '''ASCII''' format, with .asc file extension. | + | There are two files in '''ASCII''' format, with '''.asc file extension'''. |
Line 93: | Line 90: | ||
From the drop-down select '''Add Layer'''. | From the drop-down select '''Add Layer'''. | ||
− | From the sub-menu select '''Add Raster Layer'''. | + | |
+ | From the sub-menu, select '''Add Raster Layer'''. | ||
|- | |- | ||
Line 103: | Line 101: | ||
pop-1990 and pop-2000. | pop-1990 and pop-2000. | ||
− | || A dialog-box opens | + | || A dialog-box opens. I will navigate to the '''Code file '''folder on the '''Desktop'''. |
− | Select the two files with .asc file extension. | + | Select the two files with '''.asc file extension'''. |
− | Press and hold the | + | Press and hold the '''Ctrl''' key, and click on both the files. |
|- | |- | ||
− | || Click on ''' | + | || Click on '''Open''' button. |
|| Click on '''Open''' button. | || Click on '''Open''' button. | ||
Line 119: | Line 117: | ||
− | |||
− | |||
|| '''Coordinate Reference System Selector''' opens. | || '''Coordinate Reference System Selector''' opens. | ||
− | In some settings CRS will be selected automatically | + | In some settings, '''CRS''' will be selected automatically. |
+ | |||
+ | |||
+ | In such a situation this window may not open. | ||
If '''Coordinate Reference System Selector''' does not open, ignore this step and proceed with the next step. | If '''Coordinate Reference System Selector''' does not open, ignore this step and proceed with the next step. | ||
− | Here I will select '''WGS 84 EPSG 4326 '''from the list. | + | |- |
+ | ||Select '''WGS 84 EPSG:4326 '''from the list. | ||
+ | |||
+ | Click on '''OK''' button. | ||
+ | ||Here I will select '''WGS 84 EPSG 4326 '''from the list. | ||
Line 137: | Line 140: | ||
|- | |- | ||
|| Cursor on''' Coordinate Reference System Selector'''. | || Cursor on''' Coordinate Reference System Selector'''. | ||
+ | || Since we are adding two layers at the same time, '''Coordinate Reference System Selector''' opens once more here. | ||
− | + | |- | |
− | Select '''WGS 84 EPSG:4326 '''from the list. | + | ||Select '''WGS 84 EPSG:4326 '''from the list. |
Click on '''OK''' button. | Click on '''OK''' button. | ||
− | || | + | ||Again select '''WGS 84 EPSG 4326'''. |
− | + | ||
− | + | ||
− | ''' | + | |
− | |||
Click on '''OK''' button. | Click on '''OK''' button. | ||
Line 159: | Line 159: | ||
|- | |- | ||
|| Cursor on''' Layers panel'''. | || Cursor on''' Layers panel'''. | ||
− | || In the '''Layers Panel''', you will see both the raster layers loaded. | + | || In the '''Layers Panel''', you will see both the '''raster layers''' loaded. |
|- | |- | ||
|| Cursor on map. | || Cursor on map. | ||
(Zoom-in the map) | (Zoom-in the map) | ||
− | || Each pixel in the raster has a value of population density for that grid. | + | || Each '''pixel''' in the '''raster''' has a value of population density for that grid. |
|- | |- | ||
|| Click on '''Identify Features''' tool on the tool bar. (blue square icon with small i) | || Click on '''Identify Features''' tool on the tool bar. (blue square icon with small i) | ||
− | || To see the value of the pixel, | + | || To see the value of the '''pixel''', click on '''Identify Features''' tool on the top-right corner of the toolbar. |
− | + | ||
− | click on '''Identify Features''' tool on the top-right corner of the | + | |
|- | |- | ||
Line 178: | Line 176: | ||
|| Use the mouse wheel to zoom in the map. | || Use the mouse wheel to zoom in the map. | ||
− | Click anywhere on the raster map. | + | Click anywhere on the '''raster''' map. |
The pixel value will be displayed in the '''Identify Results''' panel. | The pixel value will be displayed in the '''Identify Results''' panel. | ||
Line 187: | Line 185: | ||
Click on lighter pixel. | Click on lighter pixel. | ||
− | || Observe that lighter pixel has higher value the darker pixel has lower value. | + | || Observe that lighter '''pixel''' has higher value the darker '''pixel''' has lower value. |
Line 206: | Line 204: | ||
Select''' Properties '''option. | Select''' Properties '''option. | ||
− | || Right-click on the 1st layer in the '''Layers''' | + | || Right-click on the 1st layer in the '''Layers Panel'''. |
Line 218: | Line 216: | ||
|| '''Style>>Render type>> Singleband pseudocolor''' | || '''Style>>Render type>> Singleband pseudocolor''' | ||
|| In the dialog-box box select '''Style''' tab. | || In the dialog-box box select '''Style''' tab. | ||
+ | |||
+ | |||
Under '''Band Rendering''' section, change the '''Render type''' to '''Singleband pseudocolor'''. | Under '''Band Rendering''' section, change the '''Render type''' to '''Singleband pseudocolor'''. | ||
Line 223: | Line 223: | ||
|| Under '''Load min/max values, '''click on '''Colors '''text box drop-down. | || Under '''Load min/max values, '''click on '''Colors '''text box drop-down. | ||
− | + | Choose '''Spectral'''. | |
− | + | || Let the '''Interpolation''' be '''Linear'''. | |
− | || Let the | + | |
In the '''Color''' drop-down, select '''Spectral'''. | In the '''Color''' drop-down, select '''Spectral'''. | ||
− | |||
|- | |- | ||
− | || Click on''' Classify button. ''' | + | || |
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Click on''' Classify button. ''' | ||
(Maximise the properties dialog-box). | (Maximise the properties dialog-box). | ||
Line 259: | Line 263: | ||
|| Cursor on '''QGIS''' Canvas. | || Cursor on '''QGIS''' Canvas. | ||
− | || Back in the '''QGIS''' Canvas, | + | || Back in the '''QGIS''' Canvas, you will see the '''raster''' map displayed in 5 classes of spectral color rendering. |
− | + | ||
− | you will see the raster map displayed in 5 classes of spectral color rendering. | + | |
|- | |- | ||
|| Properties>>Style>>Render type>> Singleband pseudocolor>> Classify | || Properties>>Style>>Render type>> Singleband pseudocolor>> Classify | ||
− | || Follow the same steps as shown for 1<sup>st</sup> layer and change the raster style for 2<sup>nd</sup> layer. | + | || Follow the same steps as shown for 1<sup>st</sup> '''layer''' and change the '''raster style''' for 2<sup>nd</sup> '''layer'''. |
|- | |- | ||
|| Cursor on the canvas. | || Cursor on the canvas. | ||
− | || For our analysis, | + | || For our analysis, we would like to find areas with largest population change between years 1990 and 2000. |
− | + | ||
− | we would like to find areas with largest population change between years 1990 and 2000. | + | |
|- | |- | ||
|| Cursor on panel. | || Cursor on panel. | ||
− | || For this, | + | || For this, we need to find the difference between each grid’s '''pixel''' values in both the '''layers'''. |
− | + | ||
− | we need to find the difference between each grid’s pixel values in both the layers. | + | |
− | For these calculations we will use '''Raster Calculator tool'''. | + | For these calculations, we will use '''Raster Calculator tool'''. |
|- | |- | ||
Line 298: | Line 296: | ||
|| In the '''Raster bands''' section, the names of the bands are displayed. | || In the '''Raster bands''' section, the names of the bands are displayed. | ||
− | Since each of our rasters have only 1 band, you will see only 1 entry per raster. | + | Since each of our '''rasters''' have only 1 band, you will see only 1 entry per '''raster'''. |
|- | |- | ||
|| Cursor on '''Raster bands''' section. | || Cursor on '''Raster bands''' section. | ||
− | || The raster calculator can apply mathematical operations on the raster pixels. | + | || The '''raster calculator''' can apply mathematical operations on the '''raster pixels'''. |
|- | |- | ||
|| Cursor on '''Raster bands''' section. | || Cursor on '''Raster bands''' section. | ||
− | || In this case we want to enter a simple formula to subtract | + | || In this case we want to enter a simple formula |
− | + | *to subtract the population density for the year 1990 | |
− | the population density for the year 1990 from population density for the year 2000. | + | *from population density for the year 2000. |
|- | |- | ||
|| Double-click on the raster layer for the year 2000 (pop-2000@1). | || Double-click on the raster layer for the year 2000 (pop-2000@1). | ||
− | || Under '''Raster bands''' section, select the layer by double-clicking on the raster layer for the year 2000. | + | || Under '''Raster bands''' section, select the '''layer''' by double-clicking on the '''raster layer''' for the year 2000. |
|- | |- | ||
Line 319: | Line 317: | ||
|- | |- | ||
− | || From the '''Operators''' section click on subtraction operator. | + | || From the '''Operators''' section, click on subtraction operator. |
− | From the '''Raster bands''' section double-click on raster layer for the year 1990 (pop-1990@1). | + | From the '''Raster bands''' section, double-click on '''raster layer''' for the year 1990 (pop-1990@1). |
− | || From the '''Operators''' section click on subtraction operator button. | + | || From the '''Operators''' section, click on subtraction operator button. |
− | Again from the '''Raster bands''' section double-click on raster layer for the year 1990. | + | Again from the '''Raster bands''' section, double-click on '''raster layer''' for the year 1990. |
|- | |- | ||
Line 338: | Line 336: | ||
− | In the '''output layer''' | + | In the '''output layer field''', type, '''pop-density-change.tif''' |
− | || Under '''Result Layer''' section, you will see | + | || Under '''Result Layer''' section, you will see '''Output layer''' box. |
− | |||
In the box, type the name of your '''output layer''' as '''pop-change.tif''' | In the box, type the name of your '''output layer''' as '''pop-change.tif''' | ||
Line 347: | Line 344: | ||
|- | |- | ||
|| '''Output format''' as '''Geo TIFF.''' | || '''Output format''' as '''Geo TIFF.''' | ||
− | || In the''' Output format '''drop-down | + | || In the''' Output format '''drop-down, select '''Geo TIFF. ''' |
|- | |- | ||
|| Cursor on '''Output CRS''' option. | || Cursor on '''Output CRS''' option. | ||
− | || '''Output CRS''' option is automatically selected | + | || '''Output CRS''' option is automatically selected. Leave as such. |
|- | |- | ||
Line 363: | Line 360: | ||
|- | |- | ||
|| Cursor on '''Layers Panel.''' | || Cursor on '''Layers Panel.''' | ||
− | || You will see the new layer load in '''Layers Panel'''. | + | || You will see the new '''layer''' load in '''Layers Panel'''. |
|- | |- | ||
− | || In the | + | || In the '''Layers Panel''', uncheck the check boxes for pop-2000 and pop-1990 layers. |
− | || To view the map for the 3rd layer, | + | || To view the map for the 3rd layer, in the '''Layers Panel''', uncheck the check boxes for pop-2000 and pop-1990 '''layers'''. |
− | + | ||
− | in the | + | |
− | + | ||
|- | |- | ||
|| Cursor on canvas. | || Cursor on canvas. | ||
− | || We can create a much more informative map by changing the style of this layer. | + | || We can create a much more informative map by changing the style of this '''layer'''. |
|- | |- | ||
− | || Right-click on the '''pop-density-change''' | + | || Right-click on the '''pop-density-change layer'''. |
From the '''context''' menu select '''Properties''' option. | From the '''context''' menu select '''Properties''' option. | ||
− | || Right-click on the '''pop-change''' | + | || Right-click on the '''pop-change layer'''. |
− | From the | + | From the context menu, select '''Properties''' option. |
|- | |- | ||
Line 392: | Line 386: | ||
|- | |- | ||
|| Cursor on the canvas. | || Cursor on the canvas. | ||
− | || We want to style the layer such that, pixel values in certain ranges get the same color. | + | || We want to style the '''layer''' such that, '''pixel''' values in certain ranges get the same color. |
|- | |- | ||
Line 405: | Line 399: | ||
<nowiki>=-1840.7290039062</nowiki> | <nowiki>=-1840.7290039062</nowiki> | ||
− | |||
− | |||
− | |||
|| Click on '''Metadata''' tab, scroll down to '''Properties''' section. | || Click on '''Metadata''' tab, scroll down to '''Properties''' section. | ||
Line 424: | Line 415: | ||
'''Band Rendering >>Render type s'''elect '''Singleband pseudocolor.''' | '''Band Rendering >>Render type s'''elect '''Singleband pseudocolor.''' | ||
− | || | + | || Go to the '''Style''' tab. |
Line 431: | Line 422: | ||
|- | |- | ||
|| '''interpolation>> Discrete''' | || '''interpolation>> Discrete''' | ||
− | || Set the ''' | + | || Set the '''Interpolation''' to '''Discrete'''. |
|- | |- | ||
Line 447: | Line 438: | ||
− | Click the '''Add Values Manually''' button 4 times to create 4 unique classes. | + | Click the '''Add Values Manually''' button 4 times to create 4 unique '''classes'''. |
Line 457: | Line 448: | ||
− | Population values lower than the value entered will be given the color of that entry. | + | Population values lower than the value entered, will be given the color of that entry. |
|- | |- | ||
|| Double click on value in the Value column. | || Double click on value in the Value column. | ||
− | || Double-click on the first entry in the Values column to change the value. | + | || Double-click on the first entry in the '''Values''' column to change the value. |
|- | |- | ||
Line 467: | Line 458: | ||
− | + | || We have observed, the minimum value in our '''metadata''' analysis is just above -2000. | |
− | || We have observed, the minimum value in our metadata analysis is just above -2000. | + | |
Line 493: | Line 483: | ||
Light Green | Light Green | ||
− | || In the 2<sup>nd</sup> row, -10 to denote | + | || In the 2<sup>nd</sup> row, -10 to denote '''Negative''' change. |
|- | |- | ||
Line 499: | Line 489: | ||
Pink | Pink | ||
− | || In the 3<sup>rd</sup> row, 10 to denote | + | || In the 3<sup>rd</sup> row, 10 to denote '''Neutral'''. |
|- | |- | ||
Line 505: | Line 495: | ||
Blue | Blue | ||
− | || Finally 6000 to denote Positive change. | + | || Finally 6000 to denote '''Positive''' change. |
Line 512: | Line 502: | ||
|- | |- | ||
|| Click on '''OK''' button. | || Click on '''OK''' button. | ||
− | || At the bottom-right corner of the window, | + | || At the bottom-right corner of the window, click on '''Apply '''button and then '''OK''' button. |
− | + | ||
− | + | ||
− | click on '''Apply '''button and then '''OK''' button. | + | |
|- | |- | ||
Line 523: | Line 510: | ||
Here you can see clearly areas which has seen positive and negative population density changes. | Here you can see clearly areas which has seen positive and negative population density changes. | ||
− | |||
|- | |- | ||
Line 532: | Line 518: | ||
Areas in pink have not see too much population change. | Areas in pink have not see too much population change. | ||
− | |||
|- | |- | ||
Line 544: | Line 529: | ||
*to write an expression in '''raster calculator.''' | *to write an expression in '''raster calculator.''' | ||
*About '''raster''' properties. | *About '''raster''' properties. | ||
− | |||
− | |||
|- | |- | ||
Line 554: | Line 537: | ||
*Using the population data given in the '''Code files''' link, | *Using the population data given in the '''Code files''' link, | ||
− | + | *:Create a new raster file which shows only negative population change. | |
− | + | ||
− | *Create a new raster file which shows only negative population change. | + | |
− | + | ||
− | + | ||
*Hint: Use '''Raster Calculator''', write an expression to select population change less than 0. | *Hint: Use '''Raster Calculator''', write an expression to select population change less than 0. | ||
Revision as of 17:20, 2 April 2019
Visual Cue | Narration |
Slide Number 1
Title Slide |
Welcome to this tutorial on Raster Data Styling in QGIS. |
Slide Number 2
Learning Objectives |
In this tutorial, we will learn,
|
Slide Number 3
System Requirement |
To record this tutorial, I am using,
|
Slide Number 4
Pre-requisites |
To follow this tutorial you should be familiar with QGIS interface.
|
Slide Number 5
Example for Demonstration |
Download the folder given in the Code files link, located below the player.
|
Point to Code-file folder on desktop.
Double-click on Code-file folder. |
Here is my Code files folder.
|
Point to glds00ag60.asc and glds90ag60.asc files.
|
In this folder you will find Population Density grid files for the entire world, for the year 2000 and 1990.
|
Open QGIS interface.
|
Here I have opened QGIS interface.
|
Point to Raster Data Source dialog-box.
|
A dialog-box opens. I will navigate to the Code file folder on the Desktop.
|
Click on Open button. | Click on Open button. |
Cursor on Coordinate Reference System Selector.
|
Coordinate Reference System Selector opens.
|
Select WGS 84 EPSG:4326 from the list.
Click on OK button. |
Here I will select WGS 84 EPSG 4326 from the list.
|
Cursor on Coordinate Reference System Selector. | Since we are adding two layers at the same time, Coordinate Reference System Selector opens once more here. |
Select WGS 84 EPSG:4326 from the list.
Click on OK button. |
Again select WGS 84 EPSG 4326.
|
Cursor on world map. | On the canvas you will see a world map rendered in grayscale.
Lighter pixels indicate higher population and darker pixels indicate lower population. |
Cursor on Layers panel. | In the Layers Panel, you will see both the raster layers loaded. |
Cursor on map.
(Zoom-in the map) |
Each pixel in the raster has a value of population density for that grid. |
Click on Identify Features tool on the tool bar. (blue square icon with small i) | To see the value of the pixel, click on Identify Features tool on the top-right corner of the toolbar. |
Click on a pixel on map.
Point to the value. |
Use the mouse wheel to zoom in the map.
Click anywhere on the raster map. The pixel value will be displayed in the Identify Results panel. |
Click on darker pixel.
|
Observe that lighter pixel has higher value the darker pixel has lower value.
|
Cursor on canvas. | Zoom out the map.
Click on Pan Map tool and adjust the map on the canvas. |
Population density pattern can be better visualized with an appropriate type of styling. | |
Right-click on the 1st layer in the Layers Panel.
|
Right-click on the 1st layer in the Layers Panel.
|
Cursor on Layer Properties dialog-box. | Layer Properties dialog-box opens. |
Style>>Render type>> Singleband pseudocolor | In the dialog-box box select Style tab.
|
Under Load min/max values, click on Colors text box drop-down.
Choose Spectral. |
Let the Interpolation be Linear.
In the Color drop-down, select Spectral. |
Click on Classify button. (Maximise the properties dialog-box). Cursor on Value column. |
Scroll down.
|
Cursor on the middle panel. | You will see 5 new color values created. |
Click on OK button. | Click on Apply button and OK button at the bottom right corner of the dialog-box. |
Cursor on QGIS Canvas. | Back in the QGIS Canvas, you will see the raster map displayed in 5 classes of spectral color rendering. |
Properties>>Style>>Render type>> Singleband pseudocolor>> Classify | Follow the same steps as shown for 1st layer and change the raster style for 2nd layer. |
Cursor on the canvas. | For our analysis, we would like to find areas with largest population change between years 1990 and 2000. |
Cursor on panel. | For this, we need to find the difference between each grid’s pixel values in both the layers.
For these calculations, we will use Raster Calculator tool. |
Click on Raster menu from the menu bar.
From the drop-down, click on Raster calculator. |
Click on Raster menu from the menu bar.
From the drop-down, click on Raster calculator. |
Raster Calculator dialog-box opens. | Raster Calculator dialog-box opens. |
Cursor on Raster bands section. | In the Raster bands section, the names of the bands are displayed.
Since each of our rasters have only 1 band, you will see only 1 entry per raster. |
Cursor on Raster bands section. | The raster calculator can apply mathematical operations on the raster pixels. |
Cursor on Raster bands section. | In this case we want to enter a simple formula
|
Double-click on the raster layer for the year 2000 (pop-2000@1). | Under Raster bands section, select the layer by double-clicking on the raster layer for the year 2000. |
Point to Raster calculator expression section. | The expression is now added to the Raster calculator expression section. |
From the Operators section, click on subtraction operator.
|
From the Operators section, click on subtraction operator button.
|
Cursor on formula.
pop-2000@1 - pop-1990@1 |
The formula for the calculation is now displayed in the Raster calculator expression section. |
Result Layer section, in the Output layer box,
|
Under Result Layer section, you will see Output layer box.
|
Output format as Geo TIFF. | In the Output format drop-down, select Geo TIFF. |
Cursor on Output CRS option. | Output CRS option is automatically selected. Leave as such. |
Check the box next to Add result to project. | Check the box next to Add result to project. |
Click on OK button. | Click on OK button at the bottom of the dialog-box. |
Cursor on Layers Panel. | You will see the new layer load in Layers Panel. |
In the Layers Panel, uncheck the check boxes for pop-2000 and pop-1990 layers. | To view the map for the 3rd layer, in the Layers Panel, uncheck the check boxes for pop-2000 and pop-1990 layers. |
Cursor on canvas. | We can create a much more informative map by changing the style of this layer. |
Right-click on the pop-density-change layer.
|
Right-click on the pop-change layer.
|
Cursor on Layer Properties dialog-box. | Layer Properties dialog-box opens. |
Cursor on the canvas. | We want to style the layer such that, pixel values in certain ranges get the same color. |
Click on Metadata tab
Scroll down and point towards minimum and maximum values.
STATISTICS_MINIMUM =-1840.7290039062 |
Click on Metadata tab, scroll down to Properties section.
|
Click on Style tab.
|
Go to the Style tab.
|
interpolation>> Discrete | Set the Interpolation to Discrete. |
Click the Add Values Manually (green plus symbol button located next to Classify button) button 4 times.
|
Scroll down.
|
Cursor on the values. | Here we have to change the values in each row.
|
Double click on value in the Value column. | Double-click on the first entry in the Values column to change the value. |
Type -2000.
|
We have observed, the minimum value in our metadata analysis is just above -2000.
|
Double-click on the color-box and change the color. Red color | Double-click on the color-box and change the color. |
Double-click on the Label column in the first row.
Type, No Data values. |
Double-click on the Label column in the first row.
Type, No Data values. |
Point to the table. | Similarly fill in all the values and labels as shown here. |
Point to the table.
Light Green |
In the 2nd row, -10 to denote Negative change. |
Point to the table.
Pink |
In the 3rd row, 10 to denote Neutral. |
Point to the table.
Blue |
Finally 6000 to denote Positive change.
|
Click on OK button. | At the bottom-right corner of the window, click on Apply button and then OK button. |
Point to the map on the canvas. | Now on the canvas you will see a much more powerful visualization of the population data.
|
Areas colored in blue denote the positive population.
Areas in green show negative change. Areas in pink have not see too much population change. | |
Slide Number 6
Summary |
Let's summarize,
In this tutorial we have learnt,
|
Slide Number 7
Assignment |
As an assignment
|
Your completed assignment should look as shown here. | |
Slide Number 8
About Spoken Tutorial Project |
The video at the following link summarises the spoken tutorial project. Please download and watch it.
|
Slide Number 9
Spoken Tutorial Workshops |
The spoken tutorial project team conducts workshops and gives certificates on passing online tests
For more details please write to us. |
Slide Number 10
Forum for Specific Questions |
Please post your timed queries on this forum. |
Slide number 11
Acknowledgements |
The Spoken Tutorial Project is funded by NMEICT, MHRD Government of India.
More information on this mission is available at the following link. |
Slide number 11 | This tutorial is contributed by Prajwal.M from NIT Surathkal and Snehalatha from IIT Bombay.
Thank you for watching. |