Difference between revisions of "QGIS/C2/Geometric-Properties-of-Vectors/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {|border=1 ||'''Visual Cue''' ||'''Narration''' |- || '''Slide Number 1''' '''Title Slide''' || Welcome to this tutorial on '''Geometric Properties of Vectors'''. |- || '''...")
 
 
(One intermediate revision by one other user not shown)
Line 18: Line 18:
 
* Add columns to the '''attribute table'''.
 
* Add columns to the '''attribute table'''.
 
* Calculate statistics for the '''attributes'''.
 
* Calculate statistics for the '''attributes'''.
 
  
 
|-
 
|-
Line 26: Line 25:
 
|| 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 35: Line 32:
  
 
'''Pre-requisites'''
 
'''Pre-requisites'''
||To follow this tutorial you should be familiar with,
+
||To follow this tutorial you should be familiar with '''QGIS''' interface.
 
+
'''QGIS''' interface.
+
  
  
Line 62: Line 57:
 
|-
 
|-
 
|| Show the map on desktop.
 
|| Show the map on desktop.
|| I have already downloaded the '''code file''', extracted and saved in a folder on desktop.
+
|| I have already downloaded the '''code file''', extracted and saved in a folder on the '''Desktop'''.
  
 
|-
 
|-
Line 72: Line 67:
  
 
From the context menu select '''Open with,''' '''QGIS Desktop'''.
 
From the context menu select '''Open with,''' '''QGIS Desktop'''.
|| Double-click on '''Code-file''' folder on the desktop to open it.
+
|| Double-click on '''Code-file''' folder on the '''Desktop''' to open it.
  
  
Line 78: Line 73:
  
  
From the context menu select, '''Open with QGIS Desktop'''.
+
From the context menu, select '''Open with QGIS Desktop'''.
  
 
|-
 
|-
Line 94: Line 89:
  
  
|| Map of India with lines representing railroads opens on canvas.
+
|| Map of India with lines representing railroads opens on '''canvas'''.
  
 
|-
 
|-
Line 101: Line 96:
  
  
To view this information we need to open the attribute table.
+
To view this information we need to open the '''attribute table'''.
  
 
|-
 
|-
 
|| Right-click on IND_rails layer in the Layers Panel.
 
|| Right-click on IND_rails layer in the Layers Panel.
|| Right-click on '''IND_rails''' layer in the '''Layers Panel'''.
+
|| Right-click on '''IND_rails layer''' in the '''Layers Panel'''.
  
 
|-
 
|-
Line 113: Line 108:
 
|-
 
|-
 
|| Cursor on '''attribute''' table.
 
|| Cursor on '''attribute''' table.
|| '''Attribute''' table opens.
+
|| '''Attribute table '''opens.
  
 
|-
 
|-
Line 120: Line 115:
  
  
|| The table has an '''attribute''' called '''EXS_DESCRI'''.  
+
|| The '''table''' has an '''attribute''' called '''EXS_DESCRI'''.  
  
  
We can use the value of this attribute to select features which are operational.
+
We can use the value of this '''attribute''' to select features which are operational.
  
 
|-
 
|-
Line 130: Line 125:
  
  
These are categorized as '''Operational''', '''Unexamined or Unsurveyed '''and '''not Usable'''.
+
These are categorized as '''Operational, Unexamined''' or '''Unsurveyed '''and '''not Usable'''.
  
 
|-
 
|-
Line 137: Line 132:
  
 
|-
 
|-
|| Click '''Select features using an expression''' tool in the '''attribute''' table tool bar.
+
|| Click '''Select features using an expression''' tool in the '''attribute table tool bar'''.
  
 
(It will be seen in yellow color)
 
(It will be seen in yellow color)
Line 161: Line 156:
  
 
Cursor on Expression text area.''' '''
 
Cursor on Expression text area.''' '''
|| From the list select '''EXS_DESCRI''' attribute.Double-click on it and add it to the '''Expression''' text area.  
+
|| From the list select '''EXS_DESCRI attribute'''.
 +
 
 +
Double-click on it and add it to the '''Expression''' text area.  
  
 
|-
 
|-
Line 178: Line 175:
 
|-
 
|-
 
|| Cursor on the expression.
 
|| Cursor on the expression.
|| Please note, the syntax here is case sensitive.  
+
|| Please note, the syntax here is case-sensitive.  
  
 
Type the words as they appear in the '''attribute table.'''
 
Type the words as they appear in the '''attribute table.'''
  
Here “O” in '''Operational''' is Capital letter.
+
Here “O” in '''Operational''' is capital letter.
  
 
|-
 
|-
Line 193: Line 190:
  
 
Close the attribute table.
 
Close the attribute table.
|| The '''Operational''' category are selected in the attribute table.
+
|| The '''Operational category''' are selected in the '''attribute table'''.
  
  
Line 203: Line 200:
  
  
|| On the map, you will see that all lines that fall in '''Operational''' category are selected.
+
|| On the map, you will see that all lines that fall in '''Operational category''' are selected.
  
  
Line 213: Line 210:
  
  
Right-click on '''IND_rail '''layer and select '''Save As....'''option.
+
Right-click on '''IND_rail layer''' and select '''Save As....'''option.
  
 
|-
 
|-
Line 244: Line 241:
 
|-
 
|-
 
||  
 
||  
|| Now let us select '''CRS''' for this layer.
+
|| Now let us select '''CRS''' for this '''layer'''.
  
  
Line 265: Line 262:
 
|| Under '''Coordinate Reference Systems''' of the world,  
 
|| Under '''Coordinate Reference Systems''' of the world,  
  
 
+
*in '''Geographic Coordinate Systems''' section.
in '''Geographic Coordinate Systems''' section.
+
*select '''Indian 1975 EPSG:4240.'''
 
+
select '''Indian 1975 EPSG:4240.'''
+
  
 
|-
 
|-
Line 297: Line 292:
 
|-
 
|-
 
|| Uncheck the box next to '''IND_rail''' layer.
 
|| Uncheck the box next to '''IND_rail''' layer.
|| In the '''Layers Panel''',
+
|| In the '''Layers Panel''',  
 
+
*you can uncheck the box next to''' IND_rail '''layer,
 
+
*to turn it off as we don’t need it any more.
you can uncheck the box next to''' IND_rail '''layer,
+
 
+
 
+
to turn it off as we don’t need it any more.
+
  
 
|-
 
|-
Line 319: Line 310:
 
|-
 
|-
 
|| Click '''Toggle editing''' button on the tool bar.
 
|| Click '''Toggle editing''' button on the tool bar.
|| Put the layer in editing mode by clicking on the '''Toggle editing''' tool on the tool bar.
+
|| Put the '''layer''' in editing mode by clicking on the '''Toggle editing''' tool on the '''tool bar'''.
  
 
|-
 
|-
 
|| Click on '''Open field calculator''' icon on the right-hand corner of the tool bar.
 
|| Click on '''Open field calculator''' icon on the right-hand corner of the tool bar.
|| Then click the '''Open field calculator''' button,
+
|| Then click the '''Open field calculator''' button, available on the right-hand corner of the '''tool bar'''.
 
+
available on the right-hand corner of the tool bar.
+
  
 
|-
 
|-
 
|| In the '''Field Calculator '''dialog-box, check '''Create a new field '''option.
 
|| In the '''Field Calculator '''dialog-box, check '''Create a new field '''option.
 
|| In the '''Field Calculator '''dialog-box, check '''Create a new field check box'''.
 
|| In the '''Field Calculator '''dialog-box, check '''Create a new field check box'''.
 
 
 
  
 
|-
 
|-
Line 347: Line 333:
  
 
|-
 
|-
|| Click the triangle next to Geometry, select '''$length'''.  
+
|| Click the triangle next to '''Geometry''', select '''$length'''.  
  
  
Line 395: Line 381:
  
 
click on '''save''' button,
 
click on '''save''' button,
|| In the '''Stop editing''' dialog-box,  
+
|| In the '''Stop editing''' dialog-box, click on '''Save''' button, to save the changes to the '''attribute table'''.
 
+
 
+
click on '''save''' button, to save the changes to the attribute table.
+
  
 
|-
 
|-
Line 404: Line 387:
  
 
Point to '''Length_km'''.
 
Point to '''Length_km'''.
|| Back in '''attribute''' table, a new column '''Length_km '''has been added.
+
|| Back in '''attribute table''', a new column '''Length_km '''has been added.
  
 
|-
 
|-
 
|| Cursor on '''Length_km '''column.
 
|| Cursor on '''Length_km '''column.
|| Now we have''' '''length of each individual line in '''Railway''' layer.  
+
|| Now we have length of each individual line in '''Railway layer'''.  
  
  
Line 431: Line 414:
  
 
From the sub-menu, click on '''Basic Statistics for numeric tools'''.
 
From the sub-menu, click on '''Basic Statistics for numeric tools'''.
 
 
 
  
 
|-
 
|-
Line 465: Line 445:
 
|-
 
|-
 
|| Cursor on the '''Results''' window.
 
|| Cursor on the '''Results''' window.
|| Note, The answer may vary slightly if a different projection is chosen.  
+
|| Note, the answer may vary slightly if a different '''projection''' is chosen.  
  
 
|-
 
|-
Line 472: Line 452:
  
  
These values are provided as '''attributes''' to the dataset.  
+
These values are provided as '''attributes''' to the '''dataset'''.  
  
 
|-
 
|-
 
|| Cursor on the '''Results''' window.
 
|| Cursor on the '''Results''' window.
|| The method demonstrated above works in the absence of such attribute,
+
|| The method demonstrated above works in the absence of such '''attribute'''
  
  
and as an approximation of actual line lengths.
+
And as an approximation of actual line lengths.
  
 
|-
 
|-
Line 500: Line 480:
  
 
* Use the code file '''world_1.shp''', downloaded from the '''Code files''' link.<br/>  
 
* Use the code file '''world_1.shp''', downloaded from the '''Code files''' link.<br/>  
 
 
* Find the area in square-kilometers for different countries.
 
* Find the area in square-kilometers for different countries.
 
  
 
|-
 
|-
Line 513: Line 491:
 
'''About the Spoken Tutorial Project'''
 
'''About the Spoken Tutorial Project'''
 
||The video at the following link summarises the spoken tutorial project.
 
||The video at the following link summarises the spoken tutorial project.
* Please download and watch it.
 
  
 +
Please download and watch it.
  
 
|-
 
|-
Line 520: Line 498:
  
 
'''Spoken Tutorial Workshops'''
 
'''Spoken Tutorial Workshops'''
|| * The spoken tutorial project team conducts workshops and gives certificates on passing online tests
+
||  
 +
* The spoken tutorial project team conducts workshops and gives certificates on passing online tests
 
* For more details please write to us.
 
* For more details please write to us.
 
  
 
|-
 
|-

Latest revision as of 12:14, 21 December 2018

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this tutorial on Geometric Properties of Vectors.
Slide Number 2

Learning Objectives

In this tutorial, we will learn to
  • Show selected features from the attribute table on the map.
  • Add columns to the attribute table.
  • Calculate statistics for the attributes.
Slide Number 3

System Requirement

To record this tutorial, I am using,
  • Ubuntu Linux OS version 16.04
  • QGIS version 2.18
Slide Number 4

Pre-requisites

To follow this tutorial you should be familiar with QGIS interface.


If not for relevant tutorials please visit our website.

Slide Number 5

Example map to practise


To practise this tutorial,


you need to download the folder given in the Code files link located below the player.


Extract the contents of the downloaded zip file.


Locate IND_rails.shp file in the extracted folder.

Show the map on desktop. I have already downloaded the code file, extracted and saved in a folder on the Desktop.
Double-click on Code-files.


Right-click on IND_rails.shp file.


From the context menu select Open with, QGIS Desktop.

Double-click on Code-file folder on the Desktop to open it.


Right-click on IND_rails.shp file.


From the context menu, select Open with QGIS Desktop.

Cursor on the map.


QGIS interface opens.


Click on OK button to close the QGIS tips dialog-box.

Cursor on the map.


Map of India with lines representing railroads opens on canvas.
Cursor on the map. We will calculate line lengths for rail roads which are operational.


To view this information we need to open the attribute table.

Right-click on IND_rails layer in the Layers Panel. Right-click on IND_rails layer in the Layers Panel.
From the context menu select Open Attribute Table option. From the context menu select Open Attribute Table option.
Cursor on attribute table. Attribute table opens.
Point to EXS_DESCRI column.


The table has an attribute called EXS_DESCRI.


We can use the value of this attribute to select features which are operational.

Cursor on EXS_DESCRI column. This column shows the status of a particular railway line.


These are categorized as Operational, Unexamined or Unsurveyed and not Usable.

Cursor on EXS_DESCRI column. We need to select the lines which are operational.
Click Select features using an expression tool in the attribute table tool bar.

(It will be seen in yellow color)

In the attribute table window,


Click Select features using an expression tool in the tool bar.

Cursor on Select By Expression dialog-box. A new dialog-box Select By Expression opens.
Click on black triangle next to Fields and Values option.


In the Function Editor panel,click on the black triangle next to Fields and Values option.
Double click on EXS_DESCRI.


Cursor on Expression text area.

From the list select EXS_DESCRI attribute.

Double-click on it and add it to the Expression text area.

Type the expression

= 'Operational'.

Click Select button.

Click Close button.

Complete the expression by typing


"EXS_DESCRI" equal to, in single quotes Operational

Cursor on the expression. Please note, the syntax here is case-sensitive.

Type the words as they appear in the attribute table.

Here “O” in Operational is capital letter.

Click on Select button followed by Close button at the bottom of the table. At the bottom of the table, click on Select button followed by Close button.
Point to the selected category.


Close the attribute table.

The Operational category are selected in the attribute table.


Close the attribute table.

Cursor on QGIS window.


On the map, you will see that all lines that fall in Operational category are selected.


These lines appear in yellow.

Right click on IND_rails from the context menu, select Save Selection As.... option. Now let’s save our selection to a new shapefile.


Right-click on IND_rail layer and select Save As....option.

Cursor on Save Vector Layer as ….. dialog-box. Save Vector Layer as ….. dialog-box opens.
Click on Browse button. Click on Browse button, next to File name field.
In Save Layer As... dialog-box.

Type railway.shp in the name field.

Save Layer As... dialog-box opens.


Name the output file as railway.shp.

Select Desktop.


Click on Save button.

Select a location, I will choose Desktop.


Click on Save button.

Now let us select CRS for this layer.


Click on Select CRS button.

Cursor on Coordinate Reference System Selector. Coordinate Reference System Selector dialog-box opens.
Type Indian 1975 in the Filter search box. Since we are interested in calculating length, let us select an equidistance projection.


Type Indian 1975 in the Filter search box.

Select Indian 1975 EPSG:4240. Under Coordinate Reference Systems of the world,
  • in Geographic Coordinate Systems section.
  • select Indian 1975 EPSG:4240.
Click on OK button. Click on OK button.
Cursor on Save vector layer as... dialog-box. In the Save vector layer as... dialog-box,


by default, Add saved file to map is already checked.

Tick Save only selected features box. Check Save only selected features check box.
Click on OK button. Click on OK button.
Cursor on railway layer in Layers Panel. Once the export process finishes, you will see a

new layer railway loaded in Layers Panel.

Uncheck the box next to IND_rail layer. In the Layers Panel,
  • you can uncheck the box next to IND_rail layer,
  • to turn it off as we don’t need it any more.
Cursor on the canvas. On the canvas you will see the map of India with only operational railway lines.
Right-click on the railway layer and select Open Attribute Table. Right-click on the railway layer and select Open Attribute Table.
Cursor on attribute table. Now we will add a column with length of each feature.
Click Toggle editing button on the tool bar. Put the layer in editing mode by clicking on the Toggle editing tool on the tool bar.
Click on Open field calculator icon on the right-hand corner of the tool bar. Then click the Open field calculator button, available on the right-hand corner of the tool bar.
In the Field Calculator dialog-box, check Create a new field option. In the Field Calculator dialog-box, check Create a new field check box.
In the Output field name text box, type length-km. Type length-km in the Output field name text box.
Choose Decimal number (real) as the Output field type. Choose Decimal number (real) as the Output field type.
Increase the precision to 2. Change the output Precision to 2.
Click the triangle next to Geometry, select $length.


In the Function editor panel,


Click the triangle next to Geometry and select $length.

Double click on $length. Double-click on $length to add it to the Expression text box.
Type, $length / 1000


Click on Division Operator button on top of the text window.


Type 1000

Complete the expression as $length divided by 1000.


Click on Division Operator button on top of the text window.


Type 1000 on the keyboard.

Click on OK button. We need to divide the output length by 1000,


because railway layer CRS is in meters unit and we want the output in kilo meters.


Click on OK button.

Click on Toggle editing tool. Click on Toggle editing tool to stop editing.
In the Stop editing dialog-box,


click on save button,

In the Stop editing dialog-box, click on Save button, to save the changes to the attribute table.
Cursor on Attribute table.

Point to Length_km.

Back in attribute table, a new column Length_km has been added.
Cursor on Length_km column. Now we have length of each individual line in Railway layer.


We can add it all up and find the total length.

Cursor on Attribute table. Close the attribute table.
Click on Vector menu on the menu bar.

Select Analysis Tools option.


From the sub-menu, click on Basic Statistics for numeric tools option.

Click on Vector menu on the menu bar.


Select Analysis Tools option.


From the sub-menu, click on Basic Statistics for numeric tools.

Basic Statistics for numeric tools dialog-box opens. A dialog-box opens.
Click on Input vector layer, choose railway.


Click on Field to calculate statistics on, choose length_km.

Select Input vector layer as railway.


Choose Field to calculate statistics on as length_km.

Click on Run button. Click on Run button at the bottom right corner of the dialog-box.
Point to Sum value. Results window opens.


Here you will see various statistics results.


The Sum value shown here is the total length of the railroads.

Cursor on the Results window. Note, the answer may vary slightly if a different projection is chosen.
Cursor on the Results window. In practice, line lengths for roads and other linear features are measured on the ground.


These values are provided as attributes to the dataset.

Cursor on the Results window. The method demonstrated above works in the absence of such attribute


And as an approximation of actual line lengths.

Slide Number 6

Summary

Let us summarize,

In this tutorial we have learnt to,

  • Show selected features from the attribute table on the map.
  • Add columns to the attribute table.
  • Calculate statistics for the attributes.
Slide Number 7

Assignment

Assignment
  • Use the code file world_1.shp, downloaded from the Code files link.
  • Find the area in square-kilometers for different countries.
Cursor on the asignment. Your completed assignment should look as shown here.
Slide Number 8

About the 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

Acknowledgements

This tutorial is contributed by Prajwal.M from NIT Surathkal and Snehalatha from IIT Bombay.


Thank you for joining.

Contributors and Content Editors

Nancyvarkey, Snehalathak