QGIS/C2/Geometric-Properties-of-Vectors/English-timed
From Script | Spoken-Tutorial
Revision as of 15:24, 7 December 2020 by PoojaMoolya (Talk | contribs)
| Time | Narration |
| 00:01 | Welcome to this tutorial on Geometric Properties of Vectors. |
| 00:06 | In this tutorial, we will learn to
Show selected features from the attribute table on the map. |
| 00:14 | Add columns to the attribute table. |
| 00:18 | Calculate statistics for the attributes. |
| 00:22 | To record this tutorial, I am using,
Ubuntu Linux OS version 16.04, QGIS version 2.18 |
| 00:34 | To follow this tutorial you should be familiar with QGIS interface. |
| 00:41 | If not for relevant tutorials please visit our website. |
| 00:46 | To practise this tutorial, you need to download the folder given in the Code files link located below the player. |
| 00:56 | Extract the contents of the downloaded zip file. |
| 01:00 | Locate IND_rails.shp file in the extracted folder. |
| 01:08 | I have already downloaded the code file, extracted and saved in a folder on the Desktop. |
| 01:15 | Double-click on Code-file folder on the Desktop to open it. |
| 01:21 | Right-click on IND_rails.shp file. |
| 01:27 | From the context menu, select Open with QGIS Desktop. |
| 01:35 | QGIS interface opens. |
| 01:38 | Click on OK button to close the QGIS tips dialog-box. |
| 01:44 | Map of India with lines representing railroads opens on canvas. |
| 01:51 | We will calculate line lengths for rail roads which are operational. |
| 01:57 | To view this information we need to open the attribute table. |
| 02:02 | Right-click on IND_rails layer in the Layers Panel. |
| 02:09 | From the context menu select Open Attribute Table option. |
| 02:14 | Attribute table opens. |
| 02:17 | The table has an attribute called EXS_DESCRI. |
| 02:25 | We can use the value of this attribute to select features which are operational. |
| 02:31 | This column shows the status of a particular railway line. |
| 02:36 | These are categorized as Operational, Unexamined or Unsurveyed and not Usable. |
| 02:48 | We need to select the lines which are operational. |
| 02:52 | In the attribute table window,
Click Select features using an expression tool in the tool bar. |
| 03:00 | A new dialog-box Select By Expression opens. |
| 03:05 | In the Function Editor panel, click on the black triangle next to Fields and Values option. |
| 03:13 | From the list select EXS_DESCRI attribute. |
| 03:21 | Double-click on it and add it to the Expression text area. |
| 03:26 | Complete the expression by typing
"EXS_DESCRI" equal to, in single quotes Operational |
| 03:37 | Please note, the syntax here is case-sensitive. |
| 03:42 | Type the words as they appear in the attribute table. |
| 03:47 | Here “O” in Operational is capital letter. |
| 03:52 | At the bottom of the table, click on Select button followed by Close button. |
| 03:59 | The Operational category are selected in the attribute table. |
| 04:04 | Close the attribute table. |
| 04:07 | On the map, you will see that all lines that fall in Operational category are selected. |
| 04:14 | These lines appear in yellow. |
| 04:17 | Now let’s save our selection to a new shapefile. |
| 04:22 | Right-click on IND_rail layer and select Save As....option. |
| 04:31 | Save Vector Layer as ….. dialog-box opens. |
| 04:35 | Click on Browse button, next to File name field. |
| 04:40 | Save Layer As... dialog-box opens. |
| 04:44 | Name the output file as railway.shp. |
| 04:49 | Select a location, I will choose Desktop.
Click on Save button. |
| 04:57 | Now let us select CRS for this layer.
Click on Select CRS button. |
| 05:04 | Coordinate Reference System Selector dialog-box opens. |
| 05:09 | Since we are interested in calculating length, let us select an equidistance projection. |
| 05:16 | Type Indian 1975 in the Filter search box. |
| 05:22 | Under Coordinate Reference Systems of the world, in Geographic Coordinate Systems section select Indian 1975 EPSG:4240. |
| 05:36 | Click on OK button. |
| 05:39 | In the Save vector layer as... dialog-box, by default, Add saved file to map is already checked. |
| 05:48 | Check Save only selected features check box. |
| 05:53 | Click on OK button. |
| 05:56 | Once the export process finishes, you will see a new layer railway loaded in Layers Panel. |
| 06:04 | 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. |
| 06:15 | On the canvas you will see the map of India with only operational railway lines. |
| 06:22 | Right-click on the railway layer and select Open Attribute Table. |
| 06:29 | Now we will add a column with length of each feature. |
| 06:34 | Put the layer in editing mode by clicking on the Toggle editing tool on the tool bar. |
| 06:41 | Then click the Open field calculator button, available on the right-hand corner of the tool bar. |
| 06:49 | In the Field Calculator dialog-box, check Create a new field check box. |
| 06:55 | Type length hyphen km in the Output field name text box. |
| 07:02 | Choose Decimal number (real) as the Output field type. |
| 07:07 | Change the output Precision to 2. |
| 07:10 | In the Function editor panel, Click the triangle next to Geometry and select $length. |
| 07:20 | Double-click on $length to add it to the Expression text box. |
| 07:26 | Complete the expression as $length divided by 1000. |
| 07:32 | Click on Division Operator button on top of the text window. |
| 07:37 | Type 1000 on the keyboard. |
| 07:40 | 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. |
| 07:52 | Click on OK button. |
| 07:55 | Click on Toggle editing tool to stop editing. |
| 08:00 | In the Stop editing dialog-box, click on Save button, to save the changes to the attribute table. |
| 08:07 | Back in attribute table, a new column Length hyphen km has been added. |
| 08:15 | Now we have length of each individual line in Railway layer. |
| 08:20 | We can add it all up and find the total length. |
| 08:25 | Close the attribute table. |
| 08:28 | Click on Vector menu on the menu bar.
Select Analysis Tools option. |
| 08:36 | From the sub-menu, click on Basic Statistics for numeric tools. |
| 08:42 | A dialog-box opens. |
| 08:45 | Select Input vector layer as railway. |
| 08:50 | Choose Field to calculate statistics on as length hyphen km. |
| 08:57 | Click on Run button at the bottom right corner of the dialog-box. |
| 09:03 | Results window opens. |
| 09:06 | Here you will see various statistics results. |
| 09:11 | The Sum value shown here is the total length of the railroads. |
| 09:16 | Note, the answer may vary slightly if a different projection is chosen. |
| 09:23 | In practice, line lengths for roads and other linear features are measured on the ground. |
| 09:30 | These values are provided as attributes to the dataset. |
| 09:35 | The method demonstrated above works in the absence of such attribute
And as an approximation of actual line lengths. |
| 09:46 | Let us summarize,
In this tutorial we have learnt to, |
| 09:51 | Show selected features from the attribute table on the map.
Add columns to the attribute table and Calculate statistics for the attributes. |
| 10:04 | As an Assignment
Use the code file world_1.shp, downloaded from the Code files link. |
| 10:14 | Find the area in square-kilometers for different countries. |
| 10:20 | Your completed assignment should look as shown here. |
| 10:26 | The video at the following link summarises the spoken tutorial project.
Please download and watch it. |
| 10:34 | The spoken tutorial project team conducts workshops and gives certificates on passing online tests |
| 10:41 | For more details please write to us. |
| 10:45 | Please post your timed queries on this forum. |
| 10:49 | The Spoken Tutorial Project is funded by NMEICT, MHRD Government of India.
More information on this mission is available at the following link. |
| 11:01 | This tutorial is contributed by Prajwal.M from NIT Surathkal and Snehalatha from IIT Bombay.
Thank you for joining. |