0% found this document useful (0 votes)
211 views146 pages

Introduction To Basic GIS and Spatial Analysis Using Qgis: Applications in Bangladesh

This document provides instructions for downloading and installing Quantum Geographic Information Systems (QGIS), GRASS 7, and R software. It explains how to check your Windows system type, download the QGIS installer, and complete the installation process. The document notes that installing from the OSGeo4W repository allows downloading QGIS and dependencies together. It provides step-by-step guidance on downloading the installer file and running it with administrator privileges to complete the installation.

Uploaded by

Sugeng Hartono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views146 pages

Introduction To Basic GIS and Spatial Analysis Using Qgis: Applications in Bangladesh

This document provides instructions for downloading and installing Quantum Geographic Information Systems (QGIS), GRASS 7, and R software. It explains how to check your Windows system type, download the QGIS installer, and complete the installation process. The document notes that installing from the OSGeo4W repository allows downloading QGIS and dependencies together. It provides step-by-step guidance on downloading the installer file and running it with administrator privileges to complete the installation.

Uploaded by

Sugeng Hartono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 146

Introduction to basic GIS and spatial analysis using

QGIS:

Applications in Bangladesh

Zia Uddin Ahmed


Timothy J. Krupnik
Mustafa Kamal
Introduction to basic GIS and spatial analysis using QGIS:

Applications in Bangladesh

Zia Uddin Ahmed


Timothy J. Krupnik
Mustafa Kamal

Cereal Systems Initiative for South Asia (CSISA)


Introduction to basic GIS and spatial analysis using QGIS:
Applications in Bangladesh

by Zia Uddin Ahmed, Timothy J. Krupnik and Mustafa Kamal

CIMMYT, the International Maize and Wheat Improvement Center is the global leader on
publicly funded maize and wheat research and related farming systems. Headquartered near
Mexico City, CIMMYT works with hundreds of partners throughout the developing world to
sustainably increase the productivity of maize and wheat cropping systems, thus improving
global food security and reducing poverty. CIMMYT is a member of the CGIAR Consortium
and leads the CGIAR Research Programs on MAIZE and WHEAT. The Center receives
support from national governments, foundations, development banks and other public and
private agencies.

This work is licensed under the Creative Commons Attribution


4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box
1866, Mountain View, CA 94042, USA. The designations employed in the presentation of
materials in this publications do not imply the expression of any opinion whatsoever on the
part of CIMMYT or its contributory organizations concerning the legal status of any country,
territory, city, or area, or of its authorities, or concerning the delimitation of its frontiers or
boundaries. The opinion expressed are those of the author(s), and are not necessarily those
of CIMMYT or its partners. CIMMYT encourages fair use of this material with proper citation.

Correct Citation: Ahmed, Z.U., Krupnik, T.J., Kamal, M., 2018. Introduction to basic GIS
and spatial analysis using QGIS: Applications in Bangladesh. Cereal Systems Initiative for South
Asia (CSISA) and the International Maize and Wheat Improvement Center, CIMMYT. Dhaka,
Bangladesh.

Publication Design

M. Shahidul Haque Khan


Md. Nazmul Islam Dulal

Published by

CIMMYT- Bangladesh
House 10/B, Road 53, Gulshan 2, Dhaka 1212
Tel (Land/Fax): +880 2 9896676, +880 2 9894278
Post: P.O. No. 6057, Gulshan, Dhaka 1212, Bangladesh

Published in 2018
This set of training modules was developed by the International Maize and Wheat
Improvement Center (CIMMYT) as part of the Cereal Systems Initiative for South Asia
(CSISA) project.

CSISA was established in 2009 to promote durable change at scale in South Asia’s cereal-
based cropping systems. Operating in rural ‘innovation hubs’ in Bangladesh, India and Nepal,
CSISA works to increase the adoption of various resource-conserving and climate-resilient
technologies, and to improve farmers’ access to market information and enterprise
development. CSISA supports women farmers by improving their access and exposure to
modern and improved technological innovations, knowledge and entrepreneurial skills. By
continuing to work in synergy with regional and national efforts, and by collaborating with
myriad public, civil society and private sector partners, CSISA aims to benefit more than eight
million farmers by the end of 2020.

This publication was funded by the United States Agency for International Development (USAID and
Bill and Melinda Gates Foundation (BMGF). The views and opinions expressed in this publication are
those of the author(s) and do not necessarily reflect the views of BMGF, USAID or the US Government
and the other Donors.
Table of Contents

INSTRUCTIONS BEFORE YOU BEGIN USING THIS SET OF LEARNING MODULES ......- 1 -
MODULE 1: DOWNLOADING AND INSTALLATION OF QUANTUM GEOGRAPHIC
INFORMATION SYSTEMS (QGIS), GRASS 7 AND R ........................................- 2 -
MODULE 2: AN OVERVIEW OF THE QGIS INTERFACE .....................................................- 29 -
MODULE 3: LOADING SPATIAL DATA AND VISUALIZATION IN QGIS ........................- 39 -
MODULE 4: COORDINATE REFERENCE SYSTEMS IN QGIS ..............................................- 50 -
MODULE 5: WORKING WITH GPS DATA .............................................................................- 60 -
MODULE 6: WORKING WITH TABULAR DATA ..................................................................- 65 -
MODULE 7: WORKING WITH VECTOR DATA.....................................................................- 80 -
MODULE 8: WORKING WITH RASTER DATA ......................................................................- 90 -
MODULE 9: TERRAIN ANALYSIS ............................................................................................- 94 -
MODULE 10: SPATIAL ANALYSIS .........................................................................................- 107 -
MODULE 11: GEOREFERENCING GOOGLE EARTH IMAGERY .......................................- 115 -
MODULE 12: CREATING A NEW VECTOR DATASET.......................................................- 119 -
MODULE 13: MAP PRODUCTION IN QGIS .........................................................................- 126 -
GLOSSARY OF KEYWORDS ...................................................................................................- 135 -
Instructions before you begin using this set of learning
modules

Before you begin working with these learning modules, please take time to download the data
and other information you will need to complete the hands-on exercises detailed in this book.
You can download these files as described below:

1. Go to the following link by clicking here. The website that houses the data you need
to download looks like shown below:

2. You will find listed on this webpage all of the required files that you need to use for
each module exercises in this book in zip format, as shown below.
3. Download the ten individual .zip files (one for each of the modules in this book,
beginning on Module 3 and ending with Module 13). In total, the files are over 500 MB
in size, so they may take some time to download.
4. Keep the files on the local drive of your computer, in a location that is easy to access
such as the documents folder or root location of any drive.
5. As you work through the modules in this book, you will find instructions to load
different files that are in each of the folders in the zip files. Please open and make use
of the downloaded files as required to complete the exercises in each of the modules.
6. Keep these files available, as you will be requested to import them into QGIS for the
exercises in the different modules in this book.

-1-
Module 1: Downloading and Installationof Quantum Geographic
Information Systems (QGIS), GRASS 7 and R

Before downloading and installation of QGIS and other software in Windows, check your
Windows System type (32 bit or 64 bit) to assure compatibility.

1. Click the
Windows Start
button

Start

2. Type “System” in
the search bar,
and then click
System

Search bar

-2-
64-bit

Download QGIS Installers

For installation of the latest version of QGIS please go to


https://www.qgis.org/en/site/forusers/download.htmlThe OSGeo4W repository contains a lot
of software from OSGeo projects. QGIS and all dependencies (supporting software) are
included, along with Python, GRASS 6.4.3 (http://grass.osgeo.org/), SAGA GIS2.0.8
(http://www.saga-gis.org/en/index.html), GDAL (http://www.gdal.org/), etc. If you want to run
R-script in QGIS, you have to install latest version of R (http://www.r-project.org/).

Note that this set of training modules focuses on using Windows for QGIS, although QGIS is
also compatible with Macintosh computers. Instillation is similar and many online guides for
how to work with QGIS in a MAC environment are available. Please also note that new
versions of QGIS, GRASS, GDAL and R may have been released since this publication was
completed. Where this is the case, feel free to use the new versions, although you may need
to adapt portions of the instructions in each module to some mall extent.

The QGIS installer can be installed from the internet or you can download all required
packages beforehand and then apply them. The downloaded files are located in a local
directory for future installations. Steps of the downloading QGIS installer are:

-3-
1. Click Windows Start button

2. Go to Control panel, then System, then System type

3. Click Save File. The installer will be saved in C:\Users\[yourusername]\Downloads


directory.

-4-
Installation of QGIS

For Windows XP through Windows 8 (both 32 and 64 bit), the OSGeo4W installer offers
many more choices since it includes the ability to install many other Open Source GIS
software packages and libraries such as: Quantum GIS, GRASS GIS, SAGA GIS, GDAL tools,
MapServer, OpenEV, uDig, and more.

Standalone Installer

1. To download the OSGeo4W installer click here.


2. Navigate to the directory where the downloaded osgeo4w-setup-x86_64.exe
installercan be found.
3. Right click on the installer and select Run as administrator.

4. Click Next
5. Click I Agree for the License agreement

-5-
-6-
6. Keep the default destination folder (C:\Program Files)and click Next

7. Click Install (at this point, there is no need to download training data – we will
return to this later). This part of the process takes several minutes.

-7-
8. Click Finish

Network Installer (for advanced users)

1. To download the OSGeo4W installer click here.


2. Navigate to the directory where the downloaded osgeo4w-setup-x86_64.exe
installer is exit.

3. Double-click and follow the instruction


4. Choose Advanced Install and click Next

-8-
5. Choose Install From Internet and click Next

6. Set root directory to: C:\OSGeo4W\ and check the radio button All Users,and
click Next

-9-
7. Select Local Package Directory (C:\Users\[yourusername]\Documents) as a
temporary directory, and click Next

8. Select Direct Connection and click Next

- 10 -
9. Choose download site and click Next

10. Select Packages: In the "Categories field" as shown below, click on the + symbol
before "Desktop" to extend the folder tree.

- 11 -
11. Click + (expand) and select packages to Install.

12. Click Next

- 12 -
13. Agree License Agreements (this will need to be done 4 times), and Click Next

- 13 -
Please wait, download and Installation will take several minutes, especially if you have slow internet.

- 14 -
14. Click Finish

Installation of additional plugins in QGIS

The core engine of QGIS is coded in C++, but additional QGIS plugins are written in the
scripting language Python which is easy to learn. A growing community in the field of geo-
informatics use Python to extend the functionality of QGIS. You may install additional plugins
with your internet connection. PLUGINS --> MANAGER AND INSTALL PLUGINS -->
SETTINGS. Make sure that‘Show also experimental plugins’is turned on.

When the connection with python plugin repositories is established, it becomes possible to
install necessary plugins from:

PLUGINS --> MANAGER AND INSTALL PLUGINS --> NOT INSTALLED MENU
You can also activate and deactivate the plugins in the Installed tab of the Plugin Manager.

- 15 -
Download and Installation of R

Downloading

If you want to use R function in QGIS R will need to be installed in your computer. R is an
open-source statistical software program that is increasingly popular among scientists. R can
download from the R project website (www.r-project.org ), a repository CRAN (R
development Core Team, 2014). As R is a free program, no identification is required.

1. For R installers, please go to http://www.r-project.org/


- 16 -
2. Click CRAN for download Packages

3. Select any CRAN Mirrors from the closest location on the globe proximal to your
location

- 17 -
4. Select Download R for windows

5. Click base or install R for the first time

- 18 -
6. In this set of modules, we use R. 3.1.1. Note however that more advanced versions of
R have since been released, and you can also use these in place of version 3.1.1. Click
Download R. 3.1.1 for Windows

7. Click Save File. The installer will be saved in


C:\Users\[yourusername]\Downloads directory

Installation
1. To download R-3.1.1 for Windows (32/64 bit)click here.
2. Navigate to the directory where the downloaded R-3.1.1-win.exe filejust
downloaded.
3. Double-click on it and follow the instructions.
4. Select Setup Language: click OK (Note: Keep default language English)

- 19 -
• GNU General Public License: click Next

- 20 -
• Select Destination Location as C:\OSGeo4W64\bin\R-3.1.1: click Next

• Select Components: Select 64 or 32-bit according to your system, click Next

- 21 -
• Start Option: click Next (No accept defaults)

• Select Start Manu Folder: click Next (Keep default)

- 22 -
• Select Additional Tasks: click Next (Keep default)

• Installation… (this again can take several minutes so please be patient)

- 23 -
• Click Finish

- 24 -
R Packages and Libraries

Packages are collections of R functions, data, and compiled code in a well-defined format.
The directory where packages are stored is called the library.

Installation of R-packages

If the R program has already been installed, the installation of any ‘package’ can be done
directly from the console of R through the Internet or from the local drive.

Installation from a local drive:

1. Click here to download R package named ‘agricolae’


2. Open R
3. Click Packages from menu bar
Select Install packages (s) from local zip files. Navigate to the directory where
downloadedpackages exist.
Select any package or multi multiple packages with shift key and click “Open”

Installation from Internet:

1. Choose Install Packages from the Packages menu.


2. Select a CRAN Mirror (e.g. the location closest to where your computer is)
3. Select a package (e.g. agricolae)

- 25 -
QGIS configuration for R/SAGA/GRASS GIS

Display settings
In QGIS 2.4.0, the rendering speed of displaying large image data is much improved using
multi-threading, which allows the computer to receive multiple commands from the user
without significant delays in response. This option is not enabled by default, so it is a good
idea for you to turn it on. Go to SETTINGS --> OPTIONS --> RENDERINGand click the
checkbox Render layers in parallel using many CPU cores on. Once this is done, you will find
that zooming and moving layers is considerably faster, saving your valuable time.

Configuring the Processing Toolbox

The new spatial processing framework is a highlight of QGIS 2.4. It is based on the Python
plugin SEXTANTE coded by Victor Olaya, which integrates a large number of analysis
algorithms from different open source projects. The plugin functions are activated by default
- 26 -
and can be found under the main menu PROCESSING --> TOOLBOX. A Processing Toolbox
Window should open on the right side of the GUI after you click on PROCESSING --> TOOLBOX.
On the bottom of this window,you will find the drop list button‘Simplified interface’. Please
switch this to‘Advanced interface’.

If you correctly followed the guides for QGIS and R installation on the Windows new software
versions of GDAL, OTB, GRASS GIS and SAGA, you will find that they are already installed
and correctly configured for the Processing Toolbox.

PROCESSING --> OPTIONS AND CONFIGURATION --> PROVIDERS.ExpandGRASS GIS 7


COMMANDS, GRASS COMMANDS, R-Scriptsand SAGASwitch Activateon.

Change the R Folder: C:\OSGeo4W64\bin\R-3.1.1

R-scripts folder: C:\Users\ZAhmed\.qgis2\processing\rscripts

GRASS folder: C:\OSGeo4W64\apps\grass\grass-6.4.3

- 27 -
- 28 -
Module 2: An overview of the QGIS interface

Note: Much of this module builds upon the online version of the standard QGIS manual (see:
http://docs.qgis.org/2.2/en/docs/user_manual/introduction/qgis_gui.html).Further modules
begin to use material specific to Bangladesh and South Asia with custom exercises. When you
launch QGIS, you will be presented with the GUI like the figure below (the numbers one to
six in the boxes below stand for the six major areas of the interface).

QGIS GUI:

1.MENU BAR 2. TOOLBARS

8.Processing Toolbox

3.LAYER LIST/Map
Legend

6.ADD DATA 4.MAP VIEW

7.Python console

5.STATUS BAR

Menu BAR

The menu bar is the most important area for accessing most QGIS features. It uses a standard
hierarchical menu format. Information on the menus and keyboard shortcuts to access them
are listed out below. The good news is that you can also customize and configure the
shortcuts as you wish (see using the [Configure Shortcuts] tool under ‘Settings’). Most of
the menu options have a tool that you can click on, although you need to remember that the
menus are not organized precisely like the toolbars. Instead, the toolbar with the tool can be
found after each menu option. Note that some menu options will only be visible if you have
loaded the plugin beforehand.

Project

Menu Option Shortcut Reference Toolbar

Ctrl+N see Projects Project


New

Ctrl+O see Projects Project


Open

- 29 -
Menu Option Shortcut Reference Toolbar
New from template ‣ see Projects Project
Open Recent ‣ see Projects

Save Ctrl+S see Projects Project

Save As Ctrl+Shift+S see Projects Project

Save as Image see Output

Ctrl+P see Print Composer Project


New Print Composer

see Print Composer Project


Composer manager ...
Print Composers ‣ see Print Composer
Exit |qg| Ctrl+

Edit

Menu Option Shortcut Reference Toolbar

Undo Ctrl+Z see Advanced digitizing Advanced Digitizing

Redo Ctrl+Shift+Z see Advanced digitizing Advanced Digitizing

Cut Features Ctrl+X see Digitizing an existing layer Digitizing

Copy Features Ctrl+C see Digitizing an existing layer Digitizing

Paste Features Ctrl+V see Digitizing an existing layer Digitizing

Add Feature Ctrl+. see Digitizing an existing layer Digitizing

Move Feature(s) see Digitizing an existing layer Digitizing

Delete Selected see Digitizing an existing layer Digitizing

Rotate Feature(s) see Advanced digitizing Advanced Digitizing

Simplify Feature see Advanced digitizing Advanced Digitizing

Add Ring see Advanced digitizing Advanced Digitizing

Add Part see Advanced digitizing Advanced Digitizing

Delete Ring see Advanced digitizing Advanced Digitizing

Delete Part see Advanced digitizing Advanced Digitizing

Reshape Features see Advanced digitizing Advanced Digitizing

- 30 -
Menu Option Shortcut Reference Toolbar

Offset Curves see Advanced digitizing Advanced Digitizing

see Advanced digitizing Advanced Digitizing


Split Features

Merge Selected see Advanced digitizing Advanced Digitizing


Features

Merge Attr. of see Advanced digitizing Advanced Digitizing


Selected Features

Node Tool see Digitizing an existing layer Digitizing

Rotate Point Symbols see Advanced digitizing Advanced Digitizing

View

Menu Option Shortcut Reference Toolbar

Pan Map Map Navigation

Pan Map to Selection Map Navigation

Zoom In Ctrl++ Map Navigation

Zoom Out Ctrl+- Map Navigation


see Select and
Select ‣ Attributes
deselect features

Ctrl+Shift+I Attributes
Identify Features
Measure ‣ see Measuring Attributes

Zoom Full Ctrl+Shift+F Map Navigation

Zoom To Layer Map Navigation

Zoom To Selection Ctrl+J Map Navigation

Zoom Last Map Navigation

Zoom Next Map Navigation

Zoom Actual Size Map Navigation


Decorations ‣ see Decorations

Map Tips Attributes

- 31 -
Menu Option Shortcut Reference Toolbar
see Spatial
New Bookmark Ctrl+B Attributes
Bookmarks
see Spatial
Show Bookmarks Ctrl+Shift+B Attributes
Bookmarks

Refresh Ctrl+R Map Navigation

Layer

Menu Option Shortcut Reference Toolbar


New ‣ see Creating new Vector layers Manage Layers
Embed Layers and Groups ... see Nesting Projects

Ctrl+Shift+V see Working with Vector Data Manage Layers


Add Vector Layer
see Loading raster data in
Add Raster Layer Ctrl+Shift+R Manage Layers
QGIS

Add PostGIS Layer Ctrl+Shift+D see PostGIS Layers Manage Layers

Add SpatiaLite Layer Ctrl+Shift+L see SpatiaLite Layers Manage Layers

Add MSSQL Spatial Layer Ctrl+Shift+M see label_mssql Manage Layers

Add Oracle GeoRaster see Oracle GeoRaster Plugin Manage Layers


Layer

Add SQL Anywhere Layer see SQL Anywhere Plugin Manage Layers

Add WMS/WMTS Layer Ctrl+Shift+W see WMS/WMTS Client Manage Layers

Add WCS Layer see WCS Client Manage Layers

Add WFS Layer see WFS and WFS-T Client Manage Layers

Add Delimited Text Layer see Add Delimited Text Layer Manage Layers

Copy style see Style Menu

Paste style see Style Menu


see Working with the Attribute
Open Attribute Table Attributes
Table

Toggle Editing see Digitizing an existing layer Digitizing

Save Layer Edits see Digitizing an existing layer Digitizing

Current Edits ‣ see Digitizing an existing layer Digitizing

- 32 -
Menu Option Shortcut Reference Toolbar
Save as...
See Working with the Attribute
Save selection as vector file...
Table

Remove Layer(s) Ctrl+D


Set CRS of Layer(s) Ctrl+Shift+C
Set project CRS from Layer
Properties
Query...

Labeling

Ctrl+Shift+O Manage Layers


Add to Overview

Add All To Overview

Remove All From


Overview

Show All Layers Ctrl+Shift+U Manage Layers

Hide All Layers Ctrl+Shift+H Manage Layers

Plugins

Menu Option Shortcut Reference Toolbar

Manage and Install see Managing Plugins


Plugins
Python Console
Geocode‣
GRASS ‣ see GRASS GIS Integration GRASS
Openlayers Plugin‣

Vector

Menu Option Shortcut Reference Toolbar


see Coordinate Capture
Coordinate Capture ‣ Vector
Plugin
Dxf2Shp ‣ see Dxf2Shp Converter Plugin Vector
GPS ‣ see GPS Plugin Vector

- 33 -
Menu Option Shortcut Reference Toolbar
see Loading OpenStreetMap
Open Street Map ‣
Vectors
Road Graph ‣ see Road Graph Plugin
Spatial Query ‣ see Spatial Query Plugin Vector
Topography Checker‣ Vector
Analysis Tools‣
Research Tools‣
Reprocessing Tools ‣
Geometry Tools‣
Data management Tools ‣

Raster

Menu Option Shortcut Reference Toolbar


Raster calculator see Raster Calculator
Georeferencer ‣ see Georeferencer Plugin Raster
Heatmap ‣ see Heatmap Plugin Raster
Interpolation ‣ see Interpolation Plugin Raster
Terrain Analysis
Zonal Statistics ‣ see Zonal Statistics Plugin Raste
Projection‣
Conversion‣
Extraction‣
Analysis‣

Database

Menu Option Shortcut Reference Toolbar


DB Manager‣ Database
eVis ‣ see eVis Plugin Database
Offline editing ‣
Spit ‣ see SPIT Plugin Database

Processing

- 34 -
Menu Option Shortcut Reference Toolbar
Toolbox see The toolbox Toolbox
Graphical Modeler see The graphical modeler
History and Logs see The history manager
see Configuring the
Options and configuration
processing framework
see Configuring external
Results viewer
applications
see The SEXTANTE
Commander Ctrl+Alt+M
Commander

Toolbar

The toolbar provides access to most of the same functions as the menus, plus additional tools
used when you are interacting with the map. Each toolbar item has “pop-up” help menus
available. Hold your mouse selection tool over the item and a short description of the tool’s
purpose will be displayed to guide you.

Every menu bar can be moved around according to your needs. Additionally, every menu
bar can be switched off using your right mouse button, obtained by holding the mouse over
the toolbars and right clicking (read also Panels and Toolbars).

Tip: Restoring toolbars

If you have accidentally hidden all your toolbars, you can retrieve them by choosing menu option
Settings ‣ Toolbars ‣. If a toolbar disappears under Windows, which seems to be a problem in
QGIS from time to time, you have to remove \HKEY_CURRENT_USER\Software\QGIS\qgis\UI\state
in the registry. When you restart QGIS, the key is written again with the default state, and all
toolbars are visible again.

Map Legend/Layer List

All the layers in your project will be listed in the map legend. If you check the box in each
legend entry, you can hide or reveal the layer of interest. You can drag around the layer once
you select it to change the Z-ordering. Z-ordering means that layers listed nearer the top of
the legend are shown on top of those below them in the legend. You can stop Z-ordering by
clicking ‘Layer order’ on the panel.

Your layers are organized into groups on the panel. This can be achieved in two ways:
1. Right click in the legend window and choose Add Group. Next type the group name as
you choose it, then hit enter. Next, click on an existing layer and drag it onto the
group – this will add it to the group you have named.
2. With the other method, you can choose some layers, right click in the legend window,
and select the option Group Selected. This will move the chosen layers into the new
group automatically.
- 35 -
To move a layer out of a group, you can either drag it out or right click and select ‘Make to
top-level’ item. Groups can be nested inside other groups to create hierarchies.
Remember: The checkbox for a group will show or hide all the layers in the group – this is
done with just one click. The content of the right mouse button context menu also depends
on whether the selected legend item is a raster or a vector layer. For GRASS vector layers, Toggle
editing
is not available. See sectionDigitizing and editing a GRASS vector layerfor information on
editing GRASS vector layers.

The right mouse button menu for raster layers reveals the following
information:
• Zoom to layer extent
• Zoom to Best Scale (100%)
• Stretch Using Current Extent
• Show in overview
• Remove
• Duplicate
• Set Layer CRS
• Set Project CRS from Layer
• Save as ...
• Properties
• Rename
• Copy Style
• Add New Group
• Expand all
• Collapse all
• Update Drawing Order

Additionally, according to layer position and selection


• Make to top level item
• Group Selected

Right mouse button menu for vector layers


• Zoom to Layer Extent
• Show in Overview
• Remove
• Duplicate
• Set Layer CRS
• Set Project CRS from Layer
• Open Attribute Table
• Toggle Editing (not available for GRASS layers)
• Save As ...
• Save Selection As
• Filter
• Show Feature Count
• Properties
• Rename
- 36 -
• Copy Style
• Add New Group
• Expand all
• Collapse all
• Update Drawing Order

Additionally, according to layer position and selection


• Make to top-level item
• Group Selected

Right mouse button menu for layer groups


• Zoom to Group
• Remove
• Set Group CRS
• Rename
• Add New Group
• Expand all
• Collapse all
• Update Drawing Order

It is possible to select more than one layer or group at the same time by holding down the
Control (Ctrl) key while selecting the layers with the left mouse button. You can then move
all selected layers to a new group at the same time.You are also able to delete more than one
Layer or Group at once by selecting several Layers with the Ctrl key and pressing Ctrl+D
afterwards. This way all selected Layers or groups will be removed from the layer’s list.

Map View
This is the “core business” of QGIS - maps are displayed in this area. This is where you will
do most of your work. The types of maps you see here will depend on the vector and raster
layers you have chosen to load. The map view can be panned (moved so your view changes)
left and right (this shifts the focus so you can see different regions of the map) and zoomed in
and out. A number of other operations can be done to your map, as described in the toolbar
section above.. The map view and the legend are important to each other operationally - the
maps in view reflect changes you make in the legend area.

Tip: Zooming the Map with the Mouse Wheel

You can use the mouse wheel to zoom in and out on the map. Place the mouse cursor inside
the map area and roll the wheel forward to zoom in or backwards to zoom out. You can
customize the behavior of the mouse wheel zoom using the Map tools menu under the Settings
‣ Options menu.

Tip: Panning the Map with the Arrow Keys and Space Bar

The arrow keys can be used to pan the map to the left or right, or up and down. Place the
mouse cursor inside the map area. Next click on the right arrow on the keyboard to pan East,

- 37 -
or the left arrow key to pan West, or the up arrow key to pan North, and the down arrow
key to pan South. You can also pan the map using the space bar or the click on mouse wheel
by moving the mouse while holding down space bar (or clicking on the mouse wheel).

Status Bar

The status bar shows you your current position on the map (indicated by where the mouse
cursor is) in map coordinates (e.g. meters or decimal degrees). As you move the mouse, the
coordinates change. On the left of the coordinate display in the status bar you will find a
button toggles between showing your coordinate position, or the view extent resulting when
you pan in or out of the map.

Just adjacent to the coordinate display is the scale display. This shows the scale of the map at
the view setting you have chosen (it will change as you zoom in or out). Take note of the
scale selector that allows you to choose between predefined scales that range from 1:500 to
1:1,000,000.

The progress bar can be found in the status bar. This shows progress of rendering as you
bring each successive layer into the map view. This can take some time with data heavy layers.

If a new plugin or a plugin update is available for your QGIS, you will see a message that tells
you so on the far right of the status bar. On the right side of the status bar is a small check
box that can be used to temporarily stop layers being rendered into the map view (see Section
Rendering below). The icon immediately stops the current map rendering process. This is
useful if you realize you accidently brought in the wrong layer.

Just to the right of the rendering area you will find the EPSG code of the current project
Coordinate Reference System (CRS), and a projector icon. Click on it to open data on the
projection properties of the layer.

Tip: Calculating the correct Scale of your Map Canvas

Degrees is the default unit when you boot up QGIS. Hence, any layer you add will
automatically be projected in degrees To change or get your corrected scale values, you can
either change this setting to meters manually in the General tab under Settings ‣ Project
Properties or, you can select a project CRS clicking on the CRS status icon in the lower right-
hand corner of the status bar. In the last case, the units are set to what the project projection
specifies, e.g. ‘+units=m’ for units as meters.

For more information, please see:


http://docs.qgis.org/2.2/en/docs/user_manual/introduction/qgis_gui.html

- 38 -
Module 3: Loading Spatial Data and Visualization in QGIS
The data set for this exercise is located in: MODULE_03\ Data\ directory:
1. Upazila boundary of Bangladesh (polygon- BD_UPZ_GCS.shp)
2. British Geological Survey (BGS) groundwater Arsenic data (point shape file-
bgs_groundwater.shp)
3. Road network maps of Bangladesh (BD_road_network.shp)
4. Landsat-5 image for Bangladesh (LT51370442010030KHC00_B4.TIF)

Vector Data

In this exercise, we will use three types of ESRI shapefiles (also called a shapefile). These
types include polygons, points and line or polylines. What is a shapefile? It is the most
common form of geospatial vector data used in GIS software and analyses. Shapefiles were
designed and are now regulated by ESRI, and are meant to work interchangeably to
communicate data between ESRI and GIS products. Shapefiles are built from a number of
constituent files. Three unique files are required to save the main data that is used to make a
shapefile, including: .shx (shape index format; this tags the shapefile with a position so users
can move it forward and backward among layers, a shp (shape format, which stores geometric
data, and a .dbf (attribute format file; which holds attributes (information) for the shapes in
the file). Some people refer to the .shp files as the unique shapefile itself. While this makes
sense according to name, all three files are actually required to use a shapefile.

Polygons
Polygons are two-dimensional geographical features covering a portion of the earth’s surface,
for example, forests, lakes, administrative boundaries, farmers’ fields, or any other
organizational unit the user defines. Polygons are important because their area and perimeter
can be measured.

In this exercise, we will use upazila (sub-district level) data from Bangladesh. These data
have been downloaded from
https://www.humanitarianresponse.info/applications/data/datasets/locations/bangladesh.

Steps:

1. First, launch QGIS Desktop 2.4 from your desktop


2. Click the Add Vector Layer Icon
3. or Click Layer on Menu bar and then Add Vector Layer (alternatively, this can
also be chosen from your browser)
4. Select File from Source Type
5. Select Encoding UTF-8 from the popup menu (please see
http://en.wikipedia.org/wiki/UTF-8)
6. Then click browse and select BD_UPZ_GCS.shp (note now the shapefile comes with two
additional associated files, as discussed above – maintaining these files in place in your
folder is critical for assuring that the shape files load correctly)

- 39 -
7. Then click Open

8. After clicking Open, the map should appear on the QGIS canvas

- 40 -
9. In the Layers menu to the left of the map viewer, right-click on

BD_UPZ_GCS.shp and select PROPERTIES --> STYLE. Keep Single symbol and change
FILL from Simple fill to Outline: Simple line from Symbol Layer type, then click OK.

If done correctly, the resulting map viewer will look like the following image:

- 41 -
Points Vector

Zero-dimensional points are important for geographical features like wells, soil-sampling
locations that can be best expressed by a single reference point. These points confer the least
information about these file types, and are best to represent geographical data that are very
small scale and with limited area. Examples include cities, villages, wells, farms, markets, etc.
that you would not represent with polygons. The main drawback of a point feature, however,
are that they cannot be used to make measurements (as you can with a polygon).

In this exercise, we will use British Geological Survey Groundwater Quality data for Bangladesh
(http://www.bgs.ac.uk/research/groundwater/health/arsenic/Bangladesh/data.html) as CSV file.
This CSV file contains the results of a geochemical survey of 3,534 boreholes from 61 of the
64 districts of Bangladesh. All 3,534 boreholes were georeferenced. From this CSV file, we
have created a shape file (point vector map).

Steps:

1. Click Add Vector Layer Icon


2. Select File from Source Type
3. Select Encoding UTF-8 from the popup menu
4. Then click browse and select bgs_groundwater.shp
5. Then click Open. The resulting data should look like the map below:

- 42 -
6. Now right-click on bgs_groundwater.shp (note that it may simply be called
‘bgs_groundwater’ in the layers menu (to the left of the map viewer)and select
PROPERTIES --> STYLE.
7. Change Single symbol to Graduate symbol.
8. Select Colum “was” (groundwater arsenic concentration, ug/L)
9. Click Symbol: Change
10. From Popup-windows, select Marker  Simple marker
11. Then, choose Size 1 mm and Outline style No Pen, then click OK.
12. Select Color ramp RdYIGn and check Invert
13. Choose Classes 10 and Mode Quantile
14. Click Classify and then OK

- 43 -
The resulting map should look like the display below. These steps are important if you wish
to display georeferenced data that have a gradient of values, for example in this case the
arsenic level in sampled groundwater for each of the points. Using this method, you can easily
visualize how arsenic concentrations appear to increase towards the southern region of
Bangladesh.

Note that if the color ram classification does not appear to be as shown below, you can go
to PROPERTIES -->STYLE and then click INVERT TO the left of the color ramp source.
You can also decide to use a different color ramp scheme all together, as you choose.

Lines or Polylines

One-dimensional lines, also called polylines, are used to represent geographical features like
rivers, roads, railroads, trails, and topographic lines. Note that these features are linear in
nature and do not have area like polygons. Hence, they can measure distance.In this exercise
we use road network maps of Bangladesh. This map has been downloaded from
https://www.humanitarianresponse.info/applications/data/datasets/locations/bangladesh.

Steps:

1. Click Add Vector Layer Icon


2. Select File from Source Type
3. Select Encoding UTF-8 from the popup menu
4. Then click browse and select BD_road_network.shp
5. Then click Open
6. Right clicking on BD_road_network.shpand select PROPERTIES --> STYLE.
7. Change Single symbol to Categorized.
8. Then click CLASSIFY to display the road data.

- 44 -
9. Select Colum “ROADCLASS” and Color ramp Random colors
10. Click Classify and then, OK

The resulting output should look like the below map, made more easily visible by deselecting
the groundwater and Upazila shapefiles in the layers menu.

- 45 -
Raster data

Raster data can be thought of as particular type of geographical information. Using a grid
format, it covers the space of each cell, the smallest measurement unit in the in the grid,
aligning it with a measured geographical feature in this location. Combined into a matrix, a
raster is a grid of cells. Some sources of raster data could include satellite or aerial images
and droneimager (though these types are rare) or maps that have been scanned. Data types
are flexible, including discrete and categorical data, such as those used in soil or land-use maps,
or continuous data as in digital elevation models, precipitationgradient maps, or pollutant
concentration maps, etc. Raster data are meant to be used in a complementary way to vector
data applications in GIS, so they are commonly integrated in analyses and map making.

In this exercise, we will use one scene (row 137 and row 44) of Landsat-5 TM satellite images
acquired on 30/01/2010. The Landsat-5 was collected and distributed by the USGS's Center
for Earth Resources Observation and Science (EROS) (http://eros.usgs.gov/satellite-imagery).

Steps:

1. Click the Add raster layer button and select the file
LT51370442010030KHC00_B4.TIF from
~\MODULE_03\Data\LT51370442010030KHC00. After clicking Open, the map
should appear on the QGIS canvas.

The resulting map should look roughly like the one below:

Use the tools for zooming in to increase the map scale and zoom in on the scene
of southern Bangladesh and its rivers. Use the panning tool to move the map in the

- 46 -
desired direction. If you get lost while moving the map around, you can always zoom
back to the map by clicking the Zoom to layer button.

2. Adjust the appearance of the image by right-clicking on


LT51370442010030KHC00_B4.TIF and selecting PROPERTIES --> TRANSPARENCY
--> ADJUST GLOBAL TRANSPARENCY SCALE PERCENTAGE (30%)and confirming
with Apply or OK. Note that the ‘apply’ button is useful to check the format of a
map after you have changed its properties, but before formally accepting them. This
allows you to make a number of modifications and verify them with ease.

- 47 -
3. To change map color and symbols, again select the layer with a right click and choose
PROPERTIES --> STYLE. From the pulldown menu,Render type, select Singleband
pseudocolor. A different menu will come up, where you may select the style of the
color map in the section Generate new color map. Also, make sure your color
interpretation is marked to ‘Linear’. Click Classify and confirm with Apply or OK.

- 48 -
Saving QGIS Project

Your QGIS session is considered as an individual Project. You can only work on one
project at a time in QGIS, and you can save your Project (or open a new one) in the
following ways.

PROJECT-->SAVE AS
Save you work

PROJECT-->SAVE
Load saved projects into a QGIS session using

PROJECT-->OPEN
If you wish to clear your session and start fresh, choose

PROJECT-->NEW
Either of these menu options will prompt you to save the existing project if changes
have been made since it was opened or last saved.

- 49 -
Module 4: Coordinate Reference Systems in QGIS
Coordinate reference systems use data presented in either projected or geographic
coordinate systems (see below), and are used to provide a framework to identify real-world
locations.

Geographic coordinate system

The earth is not a perfect sphere, despite being often depicted as such. Because of this,
different spheroid representations of the earth exist. Geographic coordinate systems use
latitude and longitude to measure and indicate locations on the globe, defined as a function of
direction and distance from a center point. Where representations of the globe however
differ, so will the central point from which coordinate systems are measured. This complicates
use of different coordinate systems, especially when they are to be compared, or data in one
system is imported into a GIS basal layer that uses a different system. This often requires
transformation of the coordinate system to assure alignment in the workspace. The most
common geographic coordinate system is the World Geodetic system 84 (WGS84) (EPSG:
4326), represented as follows:

GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS
84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]]

Projected coordinate system


Cartesian (x,y coordinates) approaches are used to define locations in projected coordinate
systems, which consider the global as a flat, two dimensional surface based on a flattened
representation of a sphere on a flat plane, with geographical coordinate systems. This
approach is useful where accurate distance, angle, and area measurements are needed. The
term ‘projection’ is often used interchangeably with projected coordinate systems.

Commonly use projected coordinate systems include


• Universal Transverse Mercator (UTM)
• Lambert Conformal Conic
• Albers Equal Area

The most widely utilized two-dimensional Cartesian coordinate system is the Universal
Transverse Mercator (UTM) system. UTM is interesting in that it is a horizontal positional
representation of the globe, and can be used to identify positions without having to know
their vertical location on the ‘y’ axis. It is nonetheless different than geographical coordinate
systems in that it is not a single mapped projection. It also represents the earth as sixty
- 50 -
different zones, each composed of six-degree longitudinal bands, with a secant transverse
Mercator projection in each. The Bangladesh falls in zone 45N (EPSG1:32645) and zone 46N
(EPSG: 32646).

Parameters of UTM zone 45 and 46N

UTM Zone 45N (EPSG:32645) UTM Zone 46N (EPSG:32646)

PROJCS["WGS 84 / UTM zone 45N", PROJCS["WGS 84 / UTM zone 46N",


GEOGCS["WGS 84", GEOGCS["WGS 84",
DATUM["WGS_1984", DATUM["WGS_1984",
SPHEROID["WGS SPHEROID["WGS
84",6378137,298.257223563, 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]], AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0, PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]], AUTHORITY["EPSG","8901"]],
UNIT["degree",0.01745329251994328, UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]], AUTHORITY["EPSG","4326"]],
UNIT["metre",1, UNIT["metre",1,
AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","9001"]],
PROJECTION["Transverse_Mercator"], PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0], PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",87], PARAMETER["central_meridian",93],
PARAMETER["scale_factor",0.9996], PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000], PARAMETER["false_easting",500000],
PARAMETER["false_northing",0], PARAMETER["false_northing",0],
AUTHORITY["EPSG","32645"], AUTHORITY["EPSG","32646"],
AXIS["Easting",EAST], AXIS["Easting",EAST],
AXIS["Northing",NORTH]] AXIS["Northing",NORTH]]

Bangladesh Transverse Mercator (BTM) (EPSG 3106)


For mapping of Bangladesh with a UTM projection system, a new projection system was
developed by Survey of Bangladesh, referred to as the Bangladesh Transverse Mercator (BTM)
(EPSG 3106). For conversion of WGS-84 Ellipsoid to Local Ellipsoid (Everest 1830), a custom
coordinate reference system is necessary with datum transformation parameters that known
as 7 parameters projection system.

Conversion parameter from WGS-84 Ellipsoid to Local Ellipsoid (Everest 1830)

Everest-1830 ellipsoid
Semi-major axis a (+a) = 6377276.34518 m
Semi-minor axis b (+b) = 6356075.41511 m

- 51 -
Inverse flattening 1/f = 300.8017

Datum Transformation Parameters


Method : Seven Parameters
Rotation X : 0
Rotation Y : 0
Rotation Z : 0
Translation X : 283.729 m
Translation Y : 735.942 m
Translation Z : 261.143 m
Scale : 0 ppm

Projection parameter
Projection method : Transverse Mercator
Latitude of origin (+lat_0) : 0° N
Central meridian (+lat_0) : 90° E
False Northing (+y_0 ) : -2,000,000 m
False Easting (+x_0) : 500000 m
Scale factor (+k) : 0.9996

In QGIS, the following parameters (PORJ 4) are needed for transforming CGS/ UTM with
WGS84 to BTM with a local Ellipsoid (Everest 1830)

PORJ 4 (EPSG_3106_BTM_D_GULSAN_NEW.PRJ4):

+proj=tmerc +lat_0=0 +lon_0=90 +k=0.9996 +x_0=500000 +y_0=0 +a=6377276.345


+b=6356075.41314024 +towgs84=283.7,735.9,261.1,0,0,0,0 +units=m +no_defs

- 52 -
In ArcGIS, the following PRJ file is needed (EPSG_3106_BTM_D_GULSAN_NEW.PRJ) for
transformation.
PRJ:

PROJCS["Gulshan 303 / Bangladesh Transverse


Mercator",
GEOGCS["Gulshan 303",
DATUM["Gulshan_303",
SPHEROID["Everest 1830 (1937
Adjustment)",6377276.345,300.8017,
AUTHORITY["EPSG","7015"]],
TOWGS84[283.7,735.9,261.1,0,0,0,0],
AUTHORITY["EPSG","6682"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4682"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",90],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH],
AUTHORITY["EPSG","3106"]]

The data set for this exercise is located in: MODULE_04\ Data\ :
1. Upazila boundary of Bangladesh (polygon- BD_UPZ_GCS.shp)
2. Landsat-5 image for Bangladesh (LT51370442010030KHC00_B4.TIF)
3. Four DEM raster in ALL_SHEETS_DEM_GCS sub-directory

- 53 -
Transforming Geographic Coordinate Systems to Projected coordinate
system

Create a custom CRS

In this section, we will learn how to transform geographic Coordinate Systems to a projected
coordinate system in QGIS. First, we have to create a custom CRS in QGIS for
transforming from GCS or UTM with WGS-84 Ellipsoid to BTM with a Local Ellipsoid (Everest
1830)

1. First, launch QGIS Desktop 2.4 from your desktop


2. Click Setting -> Custom CRS
3. In Custom Coordinate Reference System Definition window, click Add new
CRS
4. In Name Section, type “EPSG_3106_BTM_D_GULSAN_NEW”
5. Copy the following text and paste it in the Parameters section.

+proj=tmerc +lat_0=0 +lon_0=90 +k=0.9996 +x_0=500000


+y 0=0 +a=6377276.345 +b=6356075.41314024

6. Then Click OK
7. A new CRS named EPSG_3106_BTM_D_GULSAN_NEW will be created in
QGIS. We will use this CRS for all projection transformation in this exercise.

- 54 -
Vector Data CRS

Checking the Coordinate Reference System


In this exercise, we will learn how to check the coordinate system of vector data in QGIS.
This is important to assure you are working with the right systems, and to determine why
some layers may not render as expected.

1. If you have not done so already, launch QGIS Desktop 2.4.0 from your desktop
2. Click and load the BD_UPZ_GCS.shp file
3. To find the coordinate reference system (CRS) layer, first right click on the layer name
in the layer section, then click Properties. Next, click on the Metadata tab. The CRS
is displayed under the Layer Spatial Reference Systemheader under Properties.
The example below shows that the layer projection is Geographic coordinate
system and the datum is WGS84.

- 55 -
Projection of a Vector Data
We have already shown the BD_UPZ_GCS vector layer in a Geographic Coordinate Systems with
a datum WGS84 (EPSG:4326). In the following exercise, you will next learn how to convert GCS to
BTM using a custom CRS that we created before. This process is important to correct for incorrect
projections, and to align layers you are working with in an analysis.

1. Click and select BD_UPZ_GCS.shp file. After clicking Open, the map should
appear on the QGIS canvas (if not already completed in the step above).
2. Right click on the BD_UPZ_GCS.shp in the layers menu, then click Save as
3. Use the Save as Browse’option to choose (MODULE_04\Data) for the new layer
to be saved and give the layer name as BD_UPZ_BTM.shp, and hit return.
4. In the CRS section, select Project CRS and then Click Browse
5. Scroll down in the Coordinate reference system of world section of the
Coordinate Reference SystemSelector window, and select
EPSG_3106_BTM_D_GULSAN_NEW fromUser defined Coordinate
Systems(this may take time for you to find, but be patient).
6. Next, click OK.
7. Then Click OK again.

- 56 -
Raster Data CRS

In this exercise, which focuses on raster data as defined in Module 3, we will use Landsat 5
TM scenes downloaded from the http://glovis.usgs.gov/ website. These data have been
projected in Universal Transverse Mercator (UTM) Zone 46 with the WGS84 datum
(ESPG:32646). We can re-project a single file or multiple files with batch projection mode
from geographic coordinate systemto our custom CRS
(EPSG_3106_BTM_D_GULSAN_NEW).

Checking the Coordinate Reference System

1. Click the Add raster layer button and select the file srtm_55_08.tif from
ALL_SHEETS_DEM_GCS sub-directory of Chaper_03/Data folder.
2. After clicking Open, the map should appear on the QGIS canvas> If you encountered
an error, make sure you are opening the file under the raster prompt.
3. Check the MetaData tab in the Properties window for this raster to determine what
the Spatial Reference System (SRS) is. The SRS is displayed under the Layer Spatial
Reference Systemheader under Properties. The projection of this raster is
Geographic coordinate systemand the datum is WGS84.

- 57 -
Projection of a Single Raster:

1. On your top-bar menu, click Raster->Projection->Warp(Repoject)


2. Define Output file as strm_55_08_BTM and file type GeoTIFF and save it in
MODULE_04/Data/
3. EPSG:32646 will be popping up as Source SRS
4. Check Target SRS and Select EPSG_3106_BTM_D_GULSAN_NEW as Target
SRS
and click OK
5. Click OK again and then, Close

Batch Projection of Multiple Rasters:

1. Launch QGIS Desktop 2.4 from your desktop


2. Click Raster->Projection->Warp (Reproject)
3. Check Batch mode (for processing whole directory)
4. Select ALL_SHEETS_DEM_GCS as an Input directory.
5. Select ALL_SHEETS_DEM_BTM as a Output directory
6. Select EPSG:4326 as Source SRS and EPSG_3106_BTM_D_GULSAN_NEW as
a Target SRS
7. Click OK.

- 58 -
- 59 -
Module 5: Working with GPS data
In this section, we will show how to create a point shape file from text delimited GPS data in
QGIS. In QGIS, text delimited file is an attribute table. Each separate column has a separate
and defined data character, and each row is independent. The first row references column
names. ACSV (Comma Separated Values) file is the most widely used type of text-delimited
file, with each column separated by a comma. Longitude and latitude measurements should
be in decimal degree (DD) format only. Other formats like degrees (d), minutes (m), and
seconds (s) will result in errors. Note that GPS unit coordinates are not always pre-formatted
to DD, hence where this is the case, conversion will be necessary. DD can be rapidly
calculated in Excel using the formula below.

𝑀𝑀 𝑆𝑆
𝐷𝐷𝐷𝐷 = 𝐷𝐷 + +
60 3600

After calculation, be sure to save your output as a CSV file for import into QGIS.

In this exercise, we will use Soil Resource Development Institute (SRDI) soil survey data of
Gopalganj District (Gopalganj_SoilData.csv). You will learn how to manipulate attribute tables
and how to join data. The soil samples were collected from 0-20 cm soil depth from > 460
locations across Bangladesh, and were analyzed for pH, SOC, P, K etc. The following steps
will be used to create a point shape file with GPS and attribute data:

1. Load GPS the coordinates as a delimited CSV file (with geometry – point coordinates)
2. Load soil attribute data (with no geometry)
3. Join soil data with GPS data to create an integrated file
4. Save as ‘GPS_CORDINATES’ layer file to point shape file

Load GPS coordinate as a delimited CSV file (with geometry – point


coordinates)

Steps:

1. First, launch QGIS Desktop 2.4 from your desktop


2. Click the Add Delimited Text Icon
3. or Click Layer on Menu bar and then Add Delimited Text
4. Click Browse and Open GPS_COORDINATES.csv from
MODULE_05/Datasub-directory
5. Select Checkbox First record has field name (default)
6. Check Geometry definition: Point coordinates
7. Select X field: Longitude and Y field: Latitude
8. Click OK
9. The GPS_COORDINATES will appear on the layer canvas

- 60 -
Load soil attribute data (with no geometry)

Steps:
1. Click the Add Delimited Text Icon
2. or Click Layer on Menu bar and then Add Delimited Text
3. Click browse and select Data.csv from MODULE_05 \Datasub-directory
4. Select Checkbox First record has field name (default)
5. Check Geometry definition: No geometry (attribute only table)
6. Click OK
7. The data will appear on layer canvas

- 61 -
Join soil data with GPS data

Steps:
1. Right click on GPS_COORDINATES select PROPERTIES-->JOINS

- 62 -
2. Click +
3. Select Data as Join layer, ID as Join and Target field and then click OK (Add vector
join windows).
4. Click OK again

5. Right click on GPS_COORDINATES selectOpen attribute table. Now you can


see that all of the soil data has successfully joined with layer data. Close the
attribute table when completed.

Save as GPS_CORDINATES layer file to a point shape file

1. Right click on the GPS_COORDINATES,thenclick Save as.


2. Use the ‘Save as Browse’option to choose MODULE_05\Data for the new layer to
be saved and give the layer name as GOLPALGANJ_SOIL_DATA_BTM.shp
- 63 -
3. In the CRS section, select Project CRS and then Click Browse
4. Scroll down in Coordinate reference system of world section of the
Coordinate Reference SystemSelector window, select
EPSG_3106_BTM_D_GULSAN_NEW from User defined Coordinate Systems
(alternatively, you may locate it in the ‘recently used coordinate reference systems’
list).
5. Select this, and click OK.
6. Then Click OK again. This saves the projected shapefile with the joined attribute table
data for later use.

- 64 -
Module 6: Working with Tabular data
In this module, you will learn:
• how to calculate polygon area
• use the field calculator
• join attribute data with polygons
• generate simple statistics of a vector field
• select a polygon using an expression

Calculate Polygon Area


Before calculating polygon area, it is important to make sure your layer is in a projected
coordinate system (not in latitude/longitude), and in the correct units. (i.e. If your layer's
projection has 'meters' as units, your area will be square meters and hence will be incorrect).
You can calculate polygon area in several ways:

A. Using Vector-Geometry Tool:


4. First, launch QGIS Desktop 2.4 from your desktop
5. Load BD_UPZ_BTM.shp. (~MODULE_06\Data)
6. Click on Vector->Geometry Tools->Export/add geometry columns

7. Select BD_UPZ_BTM layer


8. Select Project CRS in Calculating using

- 65 -
9. Select the Checkbox Save to new shapefile and Browse to directory
(~MODULE_06\Data and save as BD_UPZ_BTM_GEO.shp
10. Select the Checkbox Add result to canvas and click on OK and then Close

11. Looking at the attribute table, BD_UPZ_BTM_GEO now has two addition
column titles Area (sq.m) and Perimeter.

B. Using Field Calculator:


The Field calculator is a tool for automatically calculating the area of a polygon where the
expression is $area and add a new column in the attribute table of the original layer.

- 66 -
1. If you have not already done so, right click on BD_UPZ_BTM.shp, select Open
Attribute Table

2. Click Toggle editing mode and then Open Field Calculator (Note: Field
Calculator is only activated in editing mode)

Toggle editing mode

Field Calculator

3. In Field calculator, window select the Checkbox Create a new field


4. Type ‘AreaSqKm’ in Output field Name and select ‘Decimal number (real)’ in the
Output field type
- 67 -
5. From the Function list select Geometry-> $area and double click it
6. In Expression windows, divide $area by 1000000 (the number of meters in a km2) and
then click OK.
7. A new field named AreaSqKm will be created in attribute table of existing
BD_UPZ_BTM layer.

- 68 -
8. Finally, click Toggle editing mode again and save your work. These data can be used
for a number of subsequent analyses

Calculate Population Density using Field Calculator

Load Census Population data


In this section, we will show you how to join Census population data with upazila shape file
using a common field (BBS_UPZ). First, we have to load BBS_ POP.csv file in QGIS.

1. Click Add Delimited Text Icon


2. or Click Layer on Menu bar and then Add Delimited Text
3. Click browse and select BBS_POP.csv from ~MODULE_06\Data directory
4. Select Checkbox First record has field name (default)
5. Check Geometry definition: No geometry (attribute only table)
6. Click OK
7. The population data will appear on layer

Vc
Vc
Vc

vc

vc

vc

Join Census Population data with Upazila Layer

- 69 -
1. Right click on BD_UPZ_BTM select Properties->Joins
2. Click +, select BBS_UPZ as Join and Target field. Do not alter the BBS_POP join
layer field. Then click OK to exit, and ok again to exit the layer properties.

Calculate Population Density

In this section, we calculate population density per square kilometer using total upazila
population divided by upazila area.

1. Right click on BD_UPZ_BTM.shp, select Open Attribute Table


2. Click Toggle editing mode and then Open Field Calculator (Note: Field
Calculator is only activated in editing mode)
3. In the Field calculator window select the Checkbox Create a new field
4. Type PerPop in Output field Name and select Decimal number (real) in Output
field type and Precision 1.
5. From Function list select Fields and values
6. Divide "BBS_ POP_TOTPOP" by "AreaSqKm" in Expression windows

7. Then, click OK

- 70 -
9. Finally, click Toggle editing mode again and save your work.

Visualization of Population Density


1. Right-click on BD_UPZ_BTM.shpand select PROPERTIES --> STYLE.
2. Change Single symbol to Graduate symbol.
3. Select Colum “PerPop”
4. Click Symbol: Change
5. From Popup-windows, select Border color light grey
6. Click OK
7. Select Color ramp Blue
8. Choose Classes 10 and Mode Quantile
9. Click Classify and then OK

- 71 -
c
c c
c c
c c

c c

- 72 -
Selecting Area by Expression

In this section, we will show how to select upazila or thanas where population densities are
equal or higher than the country mean population density. First, we have to calculate simple
statistics of population density. In QGIS, we can calculate statistics of a field in different ways:

Simple Statistics of a Vector Field

Option 1:

1. Select VECTOR-->ANALYSIS TOOL> BASICS STATISTICS


2. Select BD_UPZ_BTM as Input Vector Layer
3. PerPop as Target field
4. Select OK

- 73 -
c

- 74 -
Option 2:

We can calculate simple statistics and histogram of a field of a vector layer using “Statist”
plugin. If “Statist” has not been installed yet, you have to install it in QGIS first. (Important:
your computer must be connected with internet for installation of any QGIS plugin)

1. Select PLUGINS-->MANAGE AND INSTALL PLUGINSNOT INSTALLED


2. Type “Statist” in search bar
3. Select Statist and click Install plugin
4. After installation, click Close.

c c

c
c
After installation, we will use Statist plugin to get descriptive statistics and frequency
distribution of population density data.

1. Select VECTOR-->STATISTSTATIST
2. Select BF_UPZ_BTM as Input vector layer
3. PopPer as Target field and check Show grid
4. Click OK and then, Close
5. We can save histogram as PNG file in your output directory.

- 75 -
c

Save plot as PNG file


c

Option 3:

We can use R-Script in QGIS to calculate simple statistics of population density data.

1. In the Processing  Toolbox, select R-scripts -->Basic statistics Summary


statistics
2. In Summary Statistics window, select BD_UPZ_BTM as a Layer and PopPer as a Field
3. Click Run and R output will be showed in Result window.

- 76 -
c

Select Polygon using Expression


In this section, we will learn how to use Expressions to select upazila (sub-districts) where
population density is higher than the country mean (2,272 people/sq. Km).

- 77 -
1. Right click on BD_UPZ_BTM.shp, select Open Attribute Table
2. Click Select by expression
3. From the Function list, select Fields and Values
4. Double click PerPop, type >=2272 in Expression window and
5. Click Select and then, click Close.
6. The newly assigned yellow color in the map shows the upazilas where population
density is equal or greater than the country mean.

Select by expression

c c

Population
density ≥ 2272

(country mean)

- 78 -
7. We can save these selected upazila as a new shape file. Just right click on
BD_UPZ_BTM.shp, select Save As. In Save vector layer windows, Browse to
destination location and check Save only selected features and then click OK.

- 79 -
Module 7: Working with Vector Data
In this module, we will show some important techniques for vector data geoprocessing and
analysis tools in QGIS.

Convex Hull
A convex hull takes the outer border nodes from a vector shape (which you will recall may
consist of points, lines or polygons) and uses them to develop a polygon of the minimum sized
area that surrounds all features in the dataset, but that also avoids any concave angles. Below,
we will use SRDI soil sampling point (GOLPALGANJ_SOIL_DATA_BTM) data from
Gopalganj district to create a convex hullusing geoprocessing tools.

8. Click Add Vector Layer Icon


9. Select File from Source Type, and then select Encoding UTF-8 from the popup menu
10. Then click browse and select GOLPALGANJ_SOIL_DATA_BTM.shp file
(~MODULE_07\Data)
11. Then click Open
12. Click Vector -> Geoprocessing Tools -> Convex hull (s)

13. Check Create single minimum convex hull


14. Browse to the directory (~MODULE_07\Data) and save as GOPAL_CONVEX_HULL.
shp
15. Click Add result to canvas (if not already clicked)
16. Click OK and Close

- 80 -
Clipping

Clipping creates a new shape that is based on the area of the input layer, but that is overlapped
by a clipping layer. This is similar to the process of intersecting layers, but differs because the
attributes of the chosen layer are copied only to the new shape. Below, we will use Gopalganj
district boundary to clip road network polylines, inundation class land type polygons, and BGS
groundwater arsenic point data.

Polyline
1. First, load
GOPALGANJ_DIST_BD_BTM.shpandBD_ROAD_BTM.shp(~MODULE_07\Data)
files in QGIS canvas.
2. Click Vector -> Geoprocessing Tools -> CLIP
3. Select BD_ROAD_BTM as an Input vector layer and
GOPALGANJ_DIST_BD_BTM as aClip layer
4. Check Add result to canvas
5. Browse to the directory (~MODULE_07\Data) and then save as
GOPAL_ROAD.shp
6. Click OK and Close.

- 81 -
Point layer

1. Load GOPALGANJ_DIST_BD_BTM.shp and BGS_groundwater_BTM.shp


(~MODULE_07\Data) files in QGIS canvas.
2. Click Vector -> Geoprocessing Tools -> CLIP
3. Select BGS_groundwater_BTM as a Input vector layer and
GOPALGANJ_DIST_BD_BTM as a Clip layer
4. Check Add result to canvas
5. Browse to the directory (~MODULE_07\Data) and save as GOPAL_BGS.shp
6. Click OK and Close

- 82 -
Polygons

1. Load GOPALGANJ_DIST_BD_BTM.shp and BD_Lantype_BTM.shp


(~MODULE_07\Data) files in QGIS canvas.
2. Click Vector -> Geoprocessing Tools -> CLIP
3. Select BD_Landtpe_BTM as a Input vector layer and
GOPALGANJ_DIST_BD_BTM as a Clip layer
4. Check Add result to canvas
5. Browse to the directory (~MODULE_07\Data) and save as GOPAL_LandType.shp
6. Click OK (it will take several minutes to process all data and complete this work)
and then, click Close.

- 83 -
Buffer

Buffering creates an envelope of space around selected features in source layer or file. For
this reason, buffers are sometimes referred to as a zone of a specified distance around a
polygon, line, or point features. Buffering is often used for proximity analysis. In this section,
we will create 400 m buffer zones around the road network and BGS sampling points of
Gopalganj district. Such a buffer could be used later on to examine the extent of farmland or
sampling points within the buffer, etc. This activity thus has many uses for spatial quantification
and data analysis.

Buffering of Polylines

1. Load GOPAL_ROAD.shp file (~MODULE_07\Data) in QGIS canvas.


2. Click Vector -> Geoprocessing Tools -> Buffer (S)
3. Select GOPAL_ROAD as a Input vector layer
4. 400 m as Buffer distance
5. Check Dissolve buffer results and Add result to canvas
6. Browse to the directory (~MODULE_07\Data) and save as
GOPAL_ROAD_400_BUFFER.shp

- 84 -
Buffering of Point layers

1. Load GOPAL_ROAD.shp file (~MODULE_01\Data) in QGIS canvas.


2. Click Vector -> Geoprocessing Tools -> Buffer (S)
3. Select GOPAL_BGS as a Input vector layer
4. 400 m as Buffer distance
5. Check Dissolve buffer results and Add result to canvas
6. Browse to the directory (~MODULE_07\Data) and save as
GOPAL_BGS_400_BUFFER.shp

Dissolve

Dissolve separates overlapping areas in the same layer. Here, we will use a district shape file
to create a country boundary shape file after dissolving boundary all districts.

1. Load BD_DIST_BTM.shp file (MODULE_07\Data) in QGIS canvas.


2. Click Vector -> Geoprocessing Tools -> Dissolve
3. Select BD_DIST_BTM as a Input vector layer
4. Select Dissolve all in Dissolve field
5. Check Add result to canvas
6. Browse to the directory (~MODULE_07\Data\) and then save as
BD_BOUNDARY_BTM.shp
7. Click OK and Close.
- 85 -
Merge shapefiles

Here, you will learn how to merge multiple shape files to create a single shapefile. We will
use layers from seven divisions of Bangladesh to create the single layer file.

1. Click Vector -> Data Management Tools -> Merge shapefiles to one
2. Select Polygon as Shapefile type
3. Browse and select Input directory folder ~MODULE_07\Data\\BD_DIVISION
4. Browse to the directory folder (~MODULE_07\Data)and save as BD_DIV_GCS.shp.
5. Click Add result to canvass, then OK and then, close. Note that you may need to
accept each layer by clicking OK again if additional windows appear.

- 86 -
Using Query Builder to Select Areas
In this section, we will create a shape of the hilly districts using Query Builder. This is a useful
process that can be later employed to sort spatial data according to queries that you can build
(e.g., to show areas larger or smaller than a specified number or by capturing specified data).

1. Load BD_DIST_BTM.shp file (~MODULE_07\Data) in QGIS canvas.


2. Right click on BD_DIST_BTM and select Filter
3. In the Fields form, selectDIST_NAME and double click on it, and it should appear in
the Expression form.
4. Click All in Values form and all district names should appear in the values form.
5. Then, click once on the operator button “=”, and double click on'Bandarban' and then
click “OR” .
6. Double click DIST_NAME and click “ =”, click 'Cox's Bazar'.
7. Repeat steps 4-5 for Chittagong, Khagrachhari, and Rangamatidistricts. The final
expression should look as follows:
"DIST_NAME" = 'Bandarban' OR "DIST_NAME" = 'Cox''s Bazar' or "DIST_NAME" = 'Chittagong' OR
"DIST_NAME" = 'Khagrachhari' OR "DIST_NAME" = 'Rangamati'

8. Click TEST which will validate the expression. If correct, your result of the test will
indicate that the where clause returned five rows of data.
9. Then, click OK
10. Save selected districts as BD_HILLY_AREA.shpin ~MODULE_07\Data\

- 87 -
Polygon Editing

1. Load BD_HILLY_AREA_BTM.shp file (~MODULE_07\Data) in QGIS canvas.


2. Click View -> Toolbars and Check Advanced Digitizing
3. Then, click Layer -> Toggle Editing
4. Click Delete Part tools
5. With this tool we can delete all islands in the HILLY_HILLY_AREA layer file.
6. After deleting, click Layer -> Toggle Editing and save your work.

- 88 -
- 89 -
Module 8: Working with Raster Data
You will recall that raster data refers to a particular type of geographical model. Using a grid
format, data covers the space of each cell, the smallest measurement unit in the in the grid,
aligning it with a measured geographical feature for a particular location. When combined into
a matrix, a raster is a grid of cells. In this module, you will learn how to process information
from the SRTM (Shuttle Radar Topographic Mission) 90m Digital Elevation Database (v4.1)
that we have downloaded from their http://www.cgiar-csi.org/data/srtm-90m-digital-
elevation-database-v4-1 website. A total 4 sheets cover entirety of Bangladesh. These data
have been projected in a Geographic (Latitude/Longitude) projection, with the WGS84
horizontal datum and the EGM96 vertical datum. Processing such data is an important part of
the analytical process of working with raster data. We will use the following steps to process
these raster data:

1. Mergers (mosaic) of multiple sheets to create a continuous raster


2. Clipping the Merged-DEM with the Bangladesh country boundary
3. Re-projection of the Clipped-DEM to a custom CRS.

The data for this exercise are located in: ~\MODULE_08\ Data\ directory:

1. Four DEM raster in ALL_SHEETS_DEM_GCS sub-directory of MODULE_03/Data


2. Country boundary of Bangladesh

Merge

In this exercise, we will choose


the directory
(ALL_Sheets_DEM_GCS) from
MODULE_03/Data folder to
merge all sheets in this directory
to create a seamless raster using
the built-in batch processing
capability in QGIS.

1. Click on the menu item


Raster -> Miscellaneous-
> Merge
2. Check Choose input
directory instead of file

- 90 -
3. Select the ALL_Sheets_DEM_GCS folder as an Input directory from
~\MODULE_03/Data
4. Select DEM_MERGE_GCS.tif as an Output file
5. Check Load into canvas when finished
6. Click OK and then, Close

Clip

1. Open DEM_MERGE_GCS.TIF rasterand BD_BOUNDARY_GCS.shpon the QGIS


canvas. This step overlays vector data on raster data.
2. Click on the menu item Raster -> Extraction-> Clipper
3. Select DEM_MERGE_GCS as an Input file (raster) and BD_DEM_GCS as an
Output file in .tif format
4. Next, change No data value to -9999 (The aspect value -9999 is generally used as the
‘nodata’ value to indicate use of an undefined aspect in areas lacking variation in
topography, with slope=0. This will be clarified in Module 9)
5. Select Mask layer as Clipping mode and Select BD_BOUNDARY_GCS as a Mask
layer
6. Click OK and then Close

- 91 -
Re-projection
The digital elevation model, or DEM, obtained in the last step is not yet suitable as an input
for digital terrain modeling (e.g.Slope, Aspect, Curvature, etc. are incorrect). This is because
while its elevation values are in meters, cell size of the rasters is not expressed in meters (this
is because that layer uses a CRS with geographic coordinates). Because of these issues, a re-
projection is needed. To reproject a raster layer, the Warp (reproject) algorithm can be used
again. We reproject into a CRS with meters as units, so we can then correctly all spatial
analysis function.

1. Click the Add raster layer button and select the file BD_DEM_GCS.tif
2. Click Raster->Projection->Warp(Repoject)

- 92 -
3. Define Output file as BD_DEM_BTM and file type GeoTIFF
4. EPSG:4326 will be popping up as Source SRS
5. Check Target SRS and Select EPSG_3106_BTM_D_GULSAN_NEW as Target
SRS
and click OK
6. No data value as -9999, and Load into canvas when finished
7. Click OK again and then, Close. Note that processing may take some time.

- 93 -
Module 9: Terrain Analysis
Terrain analysis or land surface analysis is a process that describes terrain, for example it’s
roughness, altitude, etc., quantitatively. Such analysis can be very useful in assessing land
suitability for agriculture, construction, roads, or in designing irrigation schemes, and other
land use features. They are also very important in site selection. The following terrain
parameters will be computed from DEM data using standalone QGIS software, as well as
GRASS and SAGA plugins in QGIS. In this module, you will learn how to create the
following DEM derived terrain rasters using these commands:

1. Hillshade
2. Slope
3. Aspect
4. Color relief
5. Terrain Ruggedness Index (TRI)
6. Topographic Position Index (TPI)
7. Roughness
8. Curvature

The following data is needed for this exercise and is located in: ~\MODULE_09\ Data\
directory:

1. Elevation raster of Bangladesh (BD_DEM_BTM.tif)


2. Shape file of four hilly districts (HILLY_AREA_BTM.shp)

Processing of DEM data


Before terrain analysis, we have to create a DEM raster for four hill tract districts from DEM
data of Bangladesh by clipping it with the HILLY_AREA_BTM shape file. This will isolate
the terrain area of interest for the study we will do in this module, ending with the creation
of a new, isolated raster file.
1. Open BD_DEM_BTM.tif raster and HILLY_AREA_BTM.shp
2. Click on the menu item Raster -> Extraction-> Clipper
3. Select BD_DEM_BTM as an Input file (raster) and add HILLY_AREA_BTM.tif as
an Output file
4. No data value as -9999
5. Select Mask layer as Clipping mode and Select HILLY_AREA_BTM as a Mask layer
6. Click OK and then Close

After clipping, open Metadata tab in Layer Properties for HILLY_DEM_BTM. You will notice
that Pixel size is 89.6 x 89.6. This means each cell represents a 89.6 by 89.6 meter area. When
switching to the Style tab in Layer Properties, you will also notice that the minimum value
reads and the max value. For terrain analysis, we have to first select the grid cells where we
have elevations ranging from above sea level to mountaintops. This means excluding the
negative values. You can use the raster calculator to create a mask and apply it to your raster
all in one step.x

- 94 -
The expression looks like this:(HILLY_DEM_BTM@1 >= 0) * HILLY_DEM_BTM @1

The first part of the expression in parentheses effectively says: for every cell greater than
orequal to zero, set its value to 1, otherwise set it to 0. This creates the mask as you go
along. For the second part of the expression, the raster is multiplied (HILLY_DEM_BTM
@1) by the mask values. This sets every cell with an elevation less than zero to zero. When
you click OK, the calculator will create a new raster with the mask applied. Here is how to
do this.

1. Click the Add raster layer button and select the file HILLY_DEM_BTM.TIF
2. Click on the menu item Raster ‣ Raster Calculator
3. Write (HILLY_DEM_BTM@1 >= 0) * HILLY_DEM_BTM @1 expression in Raster
calculator expression window
4. Set the Output layer as HILLY_DEM_BTM_CORR.tif
5. Then click OK

Terrain Analysis in QGIS

In QGIS, select Raster> Analysis>DEM (Terrain Model) The below figure shows the
QGIS terrain model analysis tool menu, which is a fairly straightforward tool which allows us

- 95 -
to perform six types of raster based terrain analysis techniques, including hillshade, slope,
aspect color relief, terrain ruggedness index (TRI), topographic position index.

Hillshade

The hypothetical illumination of a surface according to a specified azimuth and altitude of the
sun. Hillshading creates a three-dimensional effect that provides a sense of visual relief for
cartography, and a relative measure of incident light for analysis. It is very useful for visualizing
the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical
exaggeration factor and a scaling factor to account for differences between vertical and
horizontal units.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models).
3. In the dialog that appears, make sure that the Input file is the DEM layer.
4. Set the Output file to HillShade.tif
5. Select Mode as Hillshade
6. Check the box next to Load into canvas when finished.
7. You may leave all the other options unchanged.
8. Click OK to generate the hillshade.
9. When it tells you that processing is completed, click OKon the message to get rid of
it. Click Close on the main DEM (Terrain models) dialog.
10. Your result should look like the image to the right.

A hillshade can provide very useful information about the pattern of shadow cast by sunlight
at a given time of day. It can also be used simply to improve the appearance of the map. Note
that you can also change the transparency of the HillShade and other raster layers.

- 96 -
1. Go to Layer properties then click style, from render type dropdown menu select
singleband pseudo color then click classify then click ok.
2. Hide all the layers except the DEM and hillshade layers.
3. Click and drag the DEM to be beneath the hillshade layer in the Layers list. Control
rendering order (beneath the list) on the bottom of your window should be checked as
well.
4. Set the hillshade layer to be transparent.
5. Open its Layer Properties and go to the Transparency tab.
6. Set the Global transparency to 50%:
7. Click OK on the Layer Properties dialog.

DEM

Hillshade

Hillshade

Slope

Slope is the incline and steepness of a surface. Slope can be measured in degrees from
horizontal (0–90), or percent slope (which is the rise divided by the run, multiplied by 100).
A slope of 30 and 45 degrees equals 58 and 100 percent slope, respectively. As slope angle
approaches vertical (90 degrees), the percent slope approaches infinity. The slope for a cell in
a raster is the steepest slope of a plane defined by the cell and its eight surrounding neighbors.
Here we will clarify how slope can be depicted with your raster data.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
- 97 -
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models).
3. In the dialog that appears, ensure that the Input file is the DEM layer.
4. Set the Output file to HILLY_Slope.tif
5. Select Mode as Slope
6. Check the box next to Load into canvas when finished.
7. You can leave all the other options unchanged (though note that you also have the
option of indicating the type of slope value you want: degrees or percent slope)
8. Click OK and Close after generating the slope map in degree.

Aspect

The compass direction that a slope faces is most commonly measured from degrees north.
The Aspect command provides a 32-bit float raster that ranges from 0° and 360°. This
represents the azimuth (the angular distance from the north to south point of the horizon
that can be transversed by a vertical circle that intersects the horizon, which represents the
direction of an object from the observer) that slopes are facing. In other words, 0° means
that the slope is facing North, 90° indicates East, 180° indicates a Southward facing, and 270°
is to the west. This however requires that the top of your input raster is north oriented, as
most are. Values found in between these ranges assume a mixture of cardinal directions, ex.
250 indicates a hillside with a Southeast facing aspect. The aspect value -9999 is generally used
as the ‘nodata’ value to indicate use of an undefined aspect in areas lacking variation in
topography, with slope=0. You can also make use of the legend to indicate the appropriate
aspect for each hillside in your study area. The legend permits you to identify North (~ 0 or

- 98 -
360 degrees), South (~ 180 degrees), East (~270 degrees) or West (~90 degrees) facing
slopes.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models)
3. In the dialog that appears, ensure that the Input file is the DEM layer
4. Set the Output file to HILLY_Aspect.tif
5. Select Mode as Aspect
6. Check the box next to Load into canvas when finished
7. You may leave all the other options unchanged
8. Click OK and Close after generating the aspect map.

Color relief

Color relief helps differentiate topography more clearly, by providing a 3-band (RGB) or 4-
band (RGBA) raster with values that is computed a color configuration file and also an
elevation file. The configuration file is based on text, and includes expressions of the
association between various elevation values and the color that is of interest to the user.
QGIS's default settings will automatically provide elevation values that are well blended,

- 99 -
making a nicely colored DEM that is easy to understand. Here is how to turn your DEM into
a color relief.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models)
3. In the dialog that appears, ensure that the Input file is the DEM layer
4. Set the Output file to HILLY_ColorRelief.tif
5. Select Mode as Color relief
6. Check the box next to Load into canvas when finished
7. You may leave all the other options unchanged
8. Click OK and Close after generating the Color Relief map

Topographic Position Indices (TPI)

Topographic Position Index (TPI) is defined as the difference between a central pixel and the
mean of its surrounding cells. The TPIare calculated at each cell of the DEM by calculating
the difference between the elevation of the cell and the mean elevation calculated for all cells
of a moving rectangular window centered on the cell of interest. Positive TPI values represent
locations that are higher than the average of their surroundings, as defined by the
neighborhood (ridges). Negative TPI values represent locations that are lower than their

- 100 -
surroundings (valleys). TPI values near zero are either flat areas (where the slope is near
zero) or areas of constant slope (where the slope of the point is significantly greater than
zero). Topographic position is an inherently scale-dependent phenomenon. TPI was generally
second most important predictive variable after elevation. With the combination with slope
raster, we can define cells with TPI values ≤ -8 m as valley bottoms, cells with TPI values ≥
8 m as ridgelines, and cells with TPI values between - 8 and + 8m and slope < 60 as gentle
slopes or slope ≥ 60 and TPI values between - 8 and + 8m as steep slopes (Dickson and
Beier, 2007)1.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models).
3. In the dialog that appears, ensure that the Input file is the DEM layer.
4. Set the Output file to HILLY_TPI .tif
5. Select Mode as TPI (Topographic Position Index)
6. Check the box next to Load into canvas when finished.
7. You may leave all the other options unchanged
8. Click OK and Close after generating the TIP map.

1 Dickson, B.G., Beier, P., 2006. Quantifying the influence of topographic position on cougar (Puma concolor) movement in
southern California, USA. Journal of Zoology 271, 270-277.

- 101 -
Topographic Ruggedness Indices (TRI)
The Terrain Ruggedness Index (TRI) can be clarified as the mean difference between a central
pixel and its surrounding cells. Using this tool, terrain heterogeneity (variation) can be
calculated. This provides a relative measure of elevational changes between a specified grid
cell and neighbors. The TRI is useful for analyzing what environments might be suited to
particular crops or species which may be sensitive to particular sloped environments, or for
assessing the potential flow of soil during erosion events, and so on.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models).
3. In the dialog that appears, ensure that the Input file is the DEM layer.
4. Set the Output file to HILLY_TRI .tif
5. Select Mode as TRI (Topographic Ruggedness Index)
6. Check the box next to Load into canvas when finished.
7. You may leave all the other options unchanged
8. Click OK and Close after generating the TRI map.

- 102 -
Roughness

When comparing among the differences in cells in a raster and a central pixel, you are making
a comparison of roughness. This is useful for helping to determine the overall variation and
frequency of change in elevation in a DEM, or particular selected parts of a DEM.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Click on the menu item Raster ‣ Analysis ‣ DEM (Terrain models).
3. In the dialog that appears, ensure that the Input file is the DEM layer.
4. Set the Output file to HILLY_ROUGH .tif
5. Select Mode as Roughness
6. Check the box next to Load into canvas when finished.
7. You may leave all the other options unchanged
8. Click OK and Close after generating the roughness map.

- 103 -
Terrain Analysis using SAGA plugin in QGIS

SAGA (System for Automated Geoscientific Analyses) GIS is a free and open source
geographic information system used for editing spatial data. Initially developed by scientists at
the University of Göttingen in Germany, SAGA, like QGIS, is being continually developed and
updated by a community of GIS users. and click OK.

Before using SAGA commands in QGIS, you need to activate SAGA following way:
PROCESSING --> OPTIONS AND CONFIGURATION --> PROVIDERS ExpandSAGA
Switch Activate and Enable SAGA Import/Export optimization to ON and click OK.

1. Click the Add raster layer button and select the file
HILLY_DEM_BTM_CORR.tif
2. Expand SAGA ->Terrain Analysis – Morphometry in the Processing Toolbox (you
may have to select this option from the menu to load this window)
3. Click on Slope, aspect, curvature
4. Elevation: HILLY_DEM_BTM_CORR
5. Method: [5] Fit 2.Degree Polynom

- 104 -
6. Save to file

Slope: ~/MODULE_09/Data/SAGA_Slope
Aspect: ~/MODULE_09/Data/SAGA_Aspect
Curvature: ~/MODULE_09/Data/SAGA_Curvature
Plan Curvature: ~/MODULE_09/Data/SAGA_PlanCurvature
Profile Curvature: ~/MODULE_09/Data/SAGA_ProfileCurvature

7. Check all Open output file after running algorithm


8. Click Run

Curvature

Curvature is the change in the degree of slope for a given distance on that slope. It is a very
helpful measure to understand the surface water flow through a landscape, and can be used
in part to help design an irrigation scheme, for example. It is widely used by hydrological
scientists. When interpreting data from a curve, any positive values indicate a convex (upward
bulging) slope, while negative values correspond to a convex (downward facing) curve. The
first is like a dinner bowl sanding correctly on a table, the latter is like a bowl that has been
flipped over and is facing down. Any pixels observed that show positive curvature indicate the
potential for liquid flow dispersal away from a central area, while and negative values indicate
accumulation. In combination, convex and concave surfaces approximate actual topography.

A Plan curve is the measurement of the rate at which a horizontal curve changes. Positive
and negative values respectively indicate divergence and convergence of a particular slope.
Highlight a divergent slope, negative values a convergent slope.

- 105 -
A Profile curve is conversely a vertical measurement of the change of a slope. Positive values
indicate convexity, while negative values represent concave profiles.

Plan curvature Profile curvature

- 106 -
Module 10: Spatial Analysis
By examining locations, attributes, and relationships between and of features of spatial data,
we conduct spatial analysis. The analytical process proceeds by overlaying layers and using
many of the tools and techniques you have learned in module 1 – 9. The result of an analysis
is usually the summary or extraction of new data from spatial information. In thismodule, we
will cover the following analytical processes:

1. Conversion of vector to raster data


2. Extraction of grid values to point shape files
3. Conversion of raster to point data
4. Reclassification processes
5. Overlaying raster data
6. Analyzing zonal statistics

The data for these exercises are located on at: ~\MODULE_10\Data

Convert a vector to raster


1. Open QGIS Desktop 2.4.0.
2. Add the GOLPALGANJ_LANDTYPE vector layer to QGIS Desktop using the Add
vectorbutton
3. Expand SAGA ->Grid-Gridding in Processing Toolbox
4. Click on Shape to grid
5. Shapes: GOLPALGANJ_LANDTYPE
6. Attribute: LT_ID
7. Method for Lines: [0] first
8. Method for Lines: [0] thin
9. Preferred Target Grid Type: [2] Integer [ 4 byte]
10. Cell size: 90.000
11. Grid: Save to file ~\MODULE_10\Data\GOPAL_LT.tif
12. Click Run

- 107 -
Extract grid values to point shape file

1. Open QGIS Desktop 2.4.0.


2. Add the GOLPALGANJ_SOIL_DATA_BTM point layer and GOPAL_DEM
and GOPAL_LT raster layers in QGIS Desktop
3. Expand SAGA ->Shapes-Grid in Processing Toolbox
4. Click on Add grid values to points
5. Points: GOLPALGANJ_SOIL_DATA_BTM
6. Grids: CheckGOPAL_DEM and GOPAL_LT and click OK
7. Interpolation: [0] Nearest Neighbor (this is a form of non-parametric pattern
recognition used in classification and regression)
8. Result: Save to file ~\MODULE_10\Data\
GOLPALGANJ_SOIL_DATA_BTM_01.shp
9. Click Run

Convert raster to point data

How can a regular grid of points and/or sample a raster dataset manipulated to extract the
individual pixel values? This is a very basic form of raster to vector point conversion.
1. Open QGIS Desktop 2.4.0.
2. Add the GOPAL_DEM raster (.tif file) and GOLPALGANJ_DIST_BD_BTM vector
layers to QGIS canvas
3. Select Vector > Research Tools > Regular Points
4. If necessary, change the Input Boundary Layer set to GOPAL_DEM.
5. In the Grid Spacing section set the point spacing value to 90 as that is the size of our
raster pixels
6. In order to make the regular points fall within the center of each pixel we will add an
offset of half our pixel size, i.e. (90 / 2) = 250. Set the Initial inset from corner (LH
side) value to 15.
7. Click the Browse button for Output Shapefile, navigate to ~\MODULE_10\Data\and
save the file as GOPAL_GRID.shp click OK or Save

- 108 -
8. By clicking OK, we clip GOPAL_GRID with GOLPALGANJ_DIST_BD_BTM
and create a new point layer (GOPAL_GRID_CLIP) using SAGA geo-processing
tools (SAGA->Shape->Cut shapes layer)

9. Expand SAGA ->Shapes-Grid in Processing Toolbox


10. Click on Add grid values to points
11. Points: GOPAL_GRID_CLIP
12. Grids: CheckGOPAL_DEM click OK
13. Interpolation: [0] Nearest Neighbor
14. Result: Save to file ~\MODULE_10\Data\
GOPAL_GRID.shp and overwrite
GOPAL_GRID
15. Click Run

Reclassification

Based on the analyses above, we will now work with


the slope and Topographic Position Index(TPI) data
to reclassify them in a way that permits meaningful,
clear interpretation. This kind of raster reclassification
will aggregate data into useful categories as follows:

- 109 -
TPI TPI Values Slope Class Slope value
Class
1 ≤ -8 m 1 < 6°
2 - 8 to + 8 m 2 ≥ 6°
3 ≤ -8 m

After you have reclassified the slope and TPI data, we will work to recombine them to identify
valley bottoms (TPI ≤ -8 m), ridgelines (TPI ≤ -8 m), gentle hill slopes (TPI= - 8 to + 8 m and
slope < 60) and steep hill slopes (TPI = - 8 to + 8 m and slope ≥ 6°).

Reclassify TPI raster

1. Load HILLY_TPI raster in QGIS canvas


2. Now, we will create a text file that contains a set of classification rules that we use to
classify the TPI rasters.
a. Open NotePad or a similar text editor and create a text file in the format below:

b. The first line tells QGIS to recode cells with TPI values < -8.0 m with a new value
of 1
c. Cells with TPI values from - 8 and + 8m will receive a new value of 2 and
d. Those cells with values ≥ 8 m will receive a new value for non-range cells (*) of
3
e. Save the text file to the ~MODULE_10 folder and name it TPI_rRecode_Rules.txt.

3. From the menu bar choose Processing Toolbox. Expand the GRASS commands
toolset Raster (r.*) r.recode - Recodes categorical raster maps.
a. Set the Input layer to HILLY_TPI.
b. Navigate to the ~\MODULE_10\DATA and select the
TPI_rRecode_Rules.txt as the File containing recode rules.
c. Name the output file RE_HILLY_TPI.tif
d. Click Run.

- 110 -
Reclassify Slope raster

1. Load the Slope raster into your QGIS canvas


2. Like the TPI raster above, we will now create a text file that contains the
classification rules that we use to classify Slope rasters

a. The first line tells QGIS to recode cells with Slope values < 6.0 ° m with a new
value of 1 ° m
b. Those cells with values≥ 6° mwill receive a new value of 2° m.
c. Save the text file to the ~\MODULE_10 folder and
name it Slope_rRecode_Rules.txt.

3. From the menu bar, next choose Processing Toolbox.


Expand the GRASS commands toolset Raster (r.*)
r.recode - Recodes categorical raster maps.

a. Set the Input layer to HILLY_Slope.


b. Navigate to the:

~\MODULE_10\DATA and select the Slope_rRecode_Rules.txt as the File


containing recode rules.

c. Name the output file RE_HILLY_Slope.tif


d. Click Run.

- 111 -
Raster Overlay

After reclassification of the slope and TPI data, we will now work to combine them to identify
valley bottoms (TPI ≤ -8° m), ridgelines (TPI ≤ -8 m), gentle hill slopes (TPI= - 8° to + 8° m
and slope < 6° m) and steep hill slopes (TPI= - 8 to + 8° m and slope ≥ 6° m).

In this next step, you will learn how to use the Raster Calculator to combine the reclassified
slope and TPI data. This tool permits the user to combine raster datasets and produce new
outputs for further analysis. Raster datasets can be added, subtracted, multiplied and divided
in a process known as raster algebra.

The expression looks like this:(("RE_HILLY_TPI@1" = 2) * "RE_HILLY_Slope@1") +


"RE_HILLY_TPI@1"

The above code can be understood as the following set of instructions. For every cell having
a TPI class 2 that indicates a range from - 8° to + 8° m), reset this value to 1, otherwise reset
it to 0, which creates a new mask. The second segment of the code indicates that this raster
will be multiplied by the resulting mask values. In the last part of the code, QGIS will add
"RE_HILLY_TPI@1” to the corresponding mask layer build a new raster with four selected
Land form classes. This process is accomplished as follows:

1. Load RE_HILLY_TPI and RE_HILLY_Slope raster in QGIS canvas


2. Click on the menu item Raster ‣ Raster Calculator

- 112 -
3. Write above expression in Raster calculator expression window
4. In the Result layer section, name the output layer ~\MODULE_10\DATA
\HILLY_LandForm.tif
5. Then click OK

Zonal statistics

The zonal statistics function summarizes values of a selected raster within the zones that can
be found in another raster or vector dataset. The function reports the resulting data in tabular

- 113 -
form or as a vector layer file. In this exercise, we will calculate descriptive elevation statistics
for four districts of hilly areas (zones) in Bangladesh using the Zonal statistics tool in QGIS.

1. Open QGIS Desktop 2.4.0.


2. Add the HILLY_DEM_BTM_CORR.tif raster and HILLY_AREA_BTM.shp
polygon layers to QGIS Desktop.
3. Expand QGIS geoalgorithms –>Raster tools in the Processing Toolbox
4. Click on Zonal Statistics
5. Raster layers: HILLY_DEM_BTM_CORR.tif
6. Vector layer containing zones: HILLY_AREA_BTM.shp
7. Output column prefix:DIST
8. Output layer: Save to file ~\MODULE_10\Data\ HILL_DIST_DEM_STAT.shp
9. Click Run

- 114 -
Module 11: Georeferencing Google Earth Imagery
Google Earth is a free program offered by the Google company that provides relatively high-
resolution satellite images online, which are updated on a regular basis. All imagery is open
source, with relatively good coverage. Where you are unable to access higher resolution or
proprietary satellite imagery, Google Earth offers a useful alternative. In this tutorial, we will
explain how you can obtain satellite imagery from Google Earth, and then export it and geo-
reference the image so that you can make maps or conduct further spatial analysis. We will
also explain how to use the clipping tool in QGIS to trim the raster imagery you will download
from Google Earth. To complete this tutorial you must have a copy of Google Earth desktop
application installed on your computer, and also have an active internet connection. Google
Earth can be downloaded here: https://www.google.com/earth/resources. Be sure to
download the most recent version of the software.

Obtaining the Google Earth Satellite Imagery

Before you can georeference an image downloaded from Google Earth in QGIS, it is important
to first set a few ground control points that have known coordinates. Without doing this, it
is impossible to georeferenced the image for further spatial analysis. In this learning session,
you will locate and indicate four basic ground control points, representing the lower left,
lower right, upper left and upper right corners of the satellite image downloaded from Google
Earth).

1. Open the Google Earth. IF you are not familiar with how to use Google Earth, it
operates similarly to QGIS or other GIS applications. Tutorials on its use can
nonetheless be located here:https://www.google.com/earth/resources
2. On the right side of the screen in the toolbar area, uncheck any borders and labels as
well as roads or boundaries as they may make the satellite image difficult to see and
read.
3. In the search bar, type Tajgaon, Dhaka Division, Bangladesh and then click the
Search button.
4. Zoom into the area of the National Parliament building.
5. Click the Add place mark button. In the Name field, enter “Corner 1”. After giving
the name, click on the place mark icon button on the right of the field. Next look at
the icon selection window. There will be a bull’s-eye mark, which you will place your
curser on and then click OK.
6. Now look for the Style toolbar. Select the, color tab set the opacity of labels to 0%.
This will hide the label so the screen and satellite image is easily visible. Nowdrag the
place mark icon to the uppermost left corner of the image, stopping wherever you
would like to delineate the boundary that will be the cut off of your satellite image.
7. Use the same process for the other corners of the image, which you will label
appropriately as corner 2, 3, and 4. When completed, you will have set up four ground
control points around the edges of the National Parliament area, delineating the
portion of the satellite image you will then extract.
8. When you are ready, position your curser the top left hand corner of Google Earth,
and select File > Save > Save Image. Give the image the title ‘Dhaka.jpg’.
9. If you have been working in fill screen mode, next press F11 to disable full screen
mode so you can see multiple programs and windows. Take a moment to note in an
- 115 -
excel spreadsheet the latitude and longitude values the four ground control points for
‘Dhaka.jpg’ that you just selected. Next, save the spreadsheet as Control_point.xls.
Next, right click on the Corner 1 place mark you set earlier, and select properties.
Go back to your spreadsheet, and copy the Longitude value and paste it into the X
column of your spreadsheet, then copy the Latitude value and do the same. QGIS
Georeferencing requires that locations be entered in X, Y pairs, which is why we have
advised this step. Repeat this process until you have X, Y pairs stored in Excel for all
four-place markers.

Georeferencing your image in QGIS

1. Open QGIS
2. Go to Raster->Georeferencer-> Georeferencer plugin
3. Click the "Open raster" icon to import your recently created satellite image.
4. Now find your way to Dhaka.jpg on your computer, select it, and click Open. The
image will then appear in the dialog box so you can work with it in QGIS.
5. Click on the zoom in tool and draw a box zoom around the Corner 1 bull’s-eye that
you will see.
6. You will now georeferenced the image in QGIS. Click the Add Point button and click
precisely in the center of the bull’s-eye. A pop-up window will then appear; that you
can add your X and Y coordinates to.
7. Using your spreadsheet as a guide, type or copy-paste the values for the lower left
bull’s-eye. It is important that you use the precise format that QGIS understands, so
your latitude and longitude values should look roughly like X: 90 22 12.31, and Y: 23
45 55.33. After you complete adding the coordinate values for Corner 1, you will see
the record appear in the GCP table below your satellite imagery in the Georeferencer
window of QGIS, as seen below.

- 116 -
8. Click OK to accept the changes you made.
9. Zoom out. Next, recreate the same steps but by entering the three other ground
control points until your image is fully georeferenced.
10. Once you have added all of the ground control points (remember, you can also add
more than four if you wish), select Settings > Transformation settings. We will be
keeping the default options of Linear transformation type, Nearest neighbor
resampling method and compression LZW
11. Once done, click on the output raster icon and find your way to the directory in which
you saved your original satellite imagery from Google Earth. Save the new file from
QGIS in the same folder, but with the name Dhaka_geo.tif.
12. For a target SRS , we suggest that you use the EPSG: 4326 coordinate system. This is
the WGS 84 global Latitude and Longitude projection.
13. It is important that you assure that the checkbox is enabled to Load in QGIS. When
you are done with this step, click OK so save the transformation settings.
14. In addition, remember to save your ground control points. This can be accomplished
by clicking Save GCP points as, and then save the ground control points into a file
called Dhaka.jpg
15. We are now ready to start georeferencing, click on the play button in the top left
hand corner of the Georeferencer window. Once the process is complete, you will
see your satellite imagery load in the main QGIS mapping area.

- 117 -
Clipping the Raster Image

You will now learn how to clip the raster image you just created, so you can work with it in
refined form.

1. In QGIS, select Raster > Extraction > Clipper


2. Select and drag a box around edges of the reduced image where you want it to be
clipped.
3. Click the select button, and then save the output file as Dhaka_geo_clip.tif
4. Don’t bother to change the rest of the default settings. You can simply leave them as
they are, and click OK
5. When you have finished the above, add the new raster layer and disable
Dhaka_geo.tif by deselecting it.
6. Dhaka_geo_clip.tif should now be visible. It should be a clean, crisp image that is the
size you want, and that is georeferenced.This new image can be used as a new
background layer or on-screen digitization, and can be subjected to additional spatial
analyses.

- 118 -
Module 12: Creating a New Vector Dataset
All data has to be sourced from somewhere. For most common geospatial applications, data
can usually be found online or in open-access databases. However, the more particular and
specialized your project, the less likely it is that data will easily be available. In these cases, you
will may need to create your own new data from existing datasets, maps, images, or other
sources. The goal for this module is to create a new vector dataset. This will provide
background on how to create data that you can use for additional analyses.

The Layer Creation Dialog

Before you can add new vector data, you need a vector dataset to add it to. In our case, you
will begin by creating a new vector dataset entirely, rather than editing an existing dataset as
you have in previous modules. Therefore, you will need to start by defining your own new
dataset.
First, you will need to open the New Vector Layer dialog that will allow you to define a new
layer.

1. First, launch QGIS Desktop 2.4 from your desktop


2. Click Layer -> New -> New Shapefile Layer

- 119 -
1. Click Point radio button from Type section of the New Shapefile Later window
2. Then under file encoding drop-down menu select file encoding UTF-8
3. Type class name in the name field
4. Keep textdata in type field
5. Leave length and precision at their default settings
6. Click ‘Add to fields list’
7. Click ‘ok’
8. ‘Save layer as’ window popup and save the shapefile as point in data directory of the
Module 12 directory.

This will create a point shapefile. In order to create a line or polygon, please select the line
or polygon radio button from the type field of new shapefile window accordingly.

- 120 -
Getting started with digitizing

In order to digitize point feature, please follow the next steps:

1. Open Dhaka_geo.tif and point.shp from


~MODULE_12\DATA folder.
2. Click the ToggleEditing button from the
Digitizing toolbar
3. Now click on the AddFeature button
from the Digitizing toolbar
4. Zoom to a specific part of the image. In
this example, we will focus on the
Bangladesh Parliament building, as shown below then click on it once.

- 121 -
5. After clicking a popup window of attribute table will appear, Type 1 in the id field
and National Parliament House in the name field.
6. A point has now been added after this attribute entry.

- 122 -
7. You can also add several additional points of interest throughout the image as you
choose.
8. Now click on the Save Layer Edits button to save your editing, and then on the
Toggle Editing button to close editing mode.

Digitizing linear features

1. Create a line shapefile following the poitn shapefile creation steps except choosing
line radio button from Type section of the New Shapefile Later window.
2. ‘Save layer as’ window popup and save the shapefile as line in data directory of the
Module 12 directory.

3. Click the Toggle Editing button from the Digitizing toolbar

4. Now click on the Add Feature button from the


Digitizing toolbar, as shown below.
5. Zoom to specific part of the image, i.e. Green road as shown below.
6. Click and insert a node for the starting point of the linear feature. Next, continue
clicking along the road until your mouse curser reaches the end of the road. After
inserting end point, right click to finish your sketch of this linear feature.
7. The atribute table will appear when you finish this. Add the identification for this
feature by adding the road name, or the name of any other feature you choose to
inlclude. This will add the linear feature in the form of a line shapefile.
8. Now click on the Save Layer Edits button to save editing and the Toggle Editing
button to close editing mode.

- 123 -
Adding polygon features

1. Create a polygon shapefile following the poitn shapefile creation steps except
choosing Polygonradio button from Type section of the New Shapefile Later window.
2. ‘Save layer as’ window popup and save the shapefile as polygon in data directory of
the Module 12 directory.
3. Click the Toggle Editing button from the Digitizing toolbar

4. Now click on the Add Feature button from the Digitizing toolbar, as shown below:

5. Click and insert a node for the starting point of your polygon feature and continue
clicking along the edge of the waterbody (Hatir Jhil) until the temporary polygon
mathes the edges of the waterbody in the image. After inserting the end point, right
click to finish your polygon representation of the waterbody.
6. The atribute table will popup when you do this. Add the identification for this feature
by adding the waterbody name, or the name of any other feature you choose to
inlclude. This will add the polygon feature in the form of a polygon shapefile.
7. Now click on the Save Layer Edits button to save your polygon. Finally, click on Toggle
Editing button to close editing mode.

- 124 -
It is important to decide which kind of dataset you want at this stage. Each different vector
layer type is “built differently” (i.e. point, line, polygon) in the background, so once you’ve
created the layer, you can’t change its type. Once you have made your first vector layers, you
can add more features using each type shapefiles you learned how to create. An example of
a more detailed set of line and polygon vector files is shown below in the following figure.

- 125 -
Module 13: Map Production in QGIS

Congratulations! You have made it to the last learning module in this QGIS educational
training. This module will bring together the skills you have learned so you can make a map
in QGIS to represent your work. The production of maps involves the process of arranging
map elements on surface in such a way that, even without many words, numbers, or additional
information, an ordinary person can read the map and understand clearly most of the
information in the map. While maps are often produced with no specific audience in mind,
some maps are highly technical and for specific specialists in specific fields. But again, the
purpose of most maps is to clearly communicate. Any map you make therefore has to be
efficient in communicating spatial data to a wide audience, or even to a specialized technical
audience. Most maps have the following components, which you will need to think about in
making your map.

• Title of the map


• Map body, including all elements
• Legend giving a title to the map or any additional components or symbols
• North arrow, so the reader of the map can orient themselves
• Scale bar to indicate distance
• Acknowledgements (if any)
• Graticules, which are parallel lines that represent latitude and longitude, so the map
can be considered in a georeferenced format

- 126 -
The Map/Print Composer
To make maps in QGIS, you will use the print composer window. It is in this window that
you will create, layout, and print all maps with their corresponding elements. The print
composer is relatively versatile, and can be used to align, change the size of, group, and arrange
all of the elements you want in your map. The print composer is also the place where you
will be able to adjust the properties of your layout. You can also export images in a variety of
different formats from the print composer. When carefully saved, you can open the layout
again to continue to work on it. Note that the tool is a bit touchy and takes some time to
learn how to efficiently make effective maps. Be patient and persevere in your learning, as it
will have great rewards. The print composer is shown below.

You will notice that the print composer has four important tabs. They are summarized below

• The first tab is the Composition tab. It is used to set the size of the paper you will print
on, orient your map, and change the quality if what you will print onto paper. This tab
also allows you to activate a grid that your image can be ‘snapped’ (positioned) to at a
resolution of your choice. You can also modify the number of pages you might expect
to print or layout your map on.
• The second tab is theItem Properties tab. This tab is used to show the properties of an
element that you can select in the map itself. To use the item properties tab, Click
the Select/Move item icon and choose an element (e.g. legend, scale, compass,
etc.) on the canvas. Watch as information about that element appears for editing.
• The third tab is particularly useful. The Atlas generation tab will generate an atlas. It also
grants you access to the atlas, which will help you to make more creative and clear
maps.

- 127 -
• The last of the tabs is the Command history tab, which is hidden by default. When
enabled, this tab displays historical accounting of each step and change that has been
made to the map while working in the print composite. By reviewing this history, you
can use a simple a mouse click undo and redo layout steps, which is very useful for
correcting errors and changing the map.

Now have a look at the icons across on the left hand size of your print composer window.
The table below reviews what some of the icons you see mean, and indicates what they do.

Display
Function
Icon
Add New Map icon is used to add a new element to your map. It is however very
important to note that if you change a map in a QGIS project, it does not automatically
update the same map that you have added to you print composer, as we shall see later.
Additional steps are needed to do this.
Add Image allows is used when you want to add a picture image to your map. Images
include compasses, or logos, or other media you think will be of use.
Add New Label. This is used when you want to add new text at a location of your
choice on the map.
Add New Legend is for adding a legend, which will conform to the active layer in the
QGIS window.
Add New Scale Bar is a self-explanatory button that adds new scales to your map to
measure length.
Add Ellipse/Triangle/Rectangle is used to when you are interested to add a shape to
your map. Use of shapes can enhance maps in many ways, ultimately to make the map
look more attractive.
Add Arrow is used to draw an arrow on the map. Arrows are useful to call the reader’s
attention to a particular element of the map.
Select / Move Item allows us to move choose and move the elements that you add to
the This is the map layout tool.With this tool selected, you can right -click on an element
to lock its position.

Load Print Composer

You will now learn how to work with print composer and make a map.

1. Open QGIS Project Module12 (~\MODULE_12\Data)


2. Change any of the colors on the map or symbols to your liking
New Print Composer
3. Click the icon or choose File ‣ New Print Composer. This action will
prompt you to give your map a unique title of your choice.

- 128 -
4. Once you have given a name you like, click OK, then a composer window will load on
your screen

Add your map


1. Looking at the Print Composer window, find and click on the Add new map icon
2. Once you have done that, click and drag your mouse across the screen. This creates
a box.
3. Once you have done that, click and drag your mouse across the screen. This creates
a box.
4. Take a moment to look at your map. If you are dissatisfied with how it is placed in
your print composer, drag the corners of the map to change its size. You can also drag
the entire element around the canvas and reposition it as you like.
5. Go to the Composition tab. Feel free to experiment with changing page numbers, size,
orientation, layout qualities, and so on, until you feel comfortable with this tool.
6. Once you have learned how to use the above tab, navigate to click on “Item
Properties”. You will find it in the right panel.
7. Take some additional time to learn how to edit and change the Scale and press Enter
when you are done. You’ll see that the scale (zoom level) of the map element changes.
A scale of about 1:36500 is more or less appropriate for this project.
8. To accomplish this, check Draw map canvas items. In the Map, check Show grid, and
in the interval field, enter X = 15000 and Y 15000.

- 129 -
9. Next check Draw coordinates
10. Select the format: DegreeMinute
11. On the left: Select outside frame and Vertical
12. Do the same for the right
13. Change your font size 12 or any size of your choosing.
14. Set the distance to the map frame (experiment with what looks good to you, but we
suggest starting with 2 mm)
15. Set coordinate precision to 1
16. You can next add a frame to your map by clicking ‘box’ next to Frame. Here you can
also change and set the frame color and line thickness to your preferences.

- 130 -
Give your map a title

1. Each map needs a good title to orient the map-reader. To add a title, click on the Add
new label button, which looks like this:
2. Adjust the size of the element to your choosing. The actual text and details of the
style and font elements are shown to the right.
3. Click the Font button and change the text size to 36 (or any size you prefer).
Experiment with making it bold, italic, or any style you choose. Change the alignment
to the center of the map (horizontal and vertical) to position the title correctly. Lastly,
add the type “Landtype Map of Gopalganj District”

- 131 -
Add a Scale Bar

1. Scale bars are crucial for giving the reader perspective on the size of the map, and to measure
distances. Click on the Add scale bar button.
2. Using your mouse, click and draw the new scale bar element on your map. Many
people prefer to place their scale on the left corner of your map layout, though you
can choose to put it anywhere you prefer.
3. You will next learn how to adjust the scrollbar options on your map. Since our project
is in a PCS (Projected Coordinate System), all of the measurements in the map will
appear in the metric system. Please enter the following information in the scale bar
options to create a standard quality scale bar, as follows:

- 132 -
Add a Legend

1. In order to add a legend to your map, first click on the Add legend button, which looks
like this:
2. Next draw a box in the area where you wish to see the legend appear in your
map. This will usually be one of the areas with blank space. After drawing the box, you
will see a legend with appear with all relevant symbols for the map elements in it.
3. What if you want to change the legend? You can do this by looking at the panel on the
right, and clicking Legend items. You cannot make use of the edit button to change the
names and other features on the legend, including the font, font size, and so on. If you
want to add or remove items from the legend, use the + and – buttons, respectively.

- 133 -
Printing the Map

• When you are done, you can print the map. Simply click on the Print button, which
looks like the symbol to the right, and follow the instructions..
• Maps can be saved in a variety of formats, including PNG images.
• Maps can also be saved as portable document viewers (PDFs), which many prefer for
emailing and printing, etc.

- 134 -
Glossary of keywords

Azimuth
The angular distance from the north to south point of the horizon that can be transversed by a vertical
circle that intersects the horizon, which represents the direction of an object from the observer.

Buffer (or buffering)


Buffering creates an envelope of space around selected features in source layer or file. For this reason,
buffers are sometimes referred to as a zone of a specified distance around a polygon, line, or point
features. Buffering is often used for proximity analysis.

Clipping
Action that creates a new shape based on the input layer's area, that is overlapped by a clipping layer.
Not to be confused with intersection.

Color ramp
A specified range of colors that change depending on the value of measured data, used to display
gradients on a map.

Convex hull
A convex hull takes the outer border nodes from a vector shape (which you will recall may consist of
points, lines or polygons) and uses them to develop a polygon of the minimum sized area that
surrounds all features in the dataset, but that also avoids any concave angles.

Comma separated values (CSV)


A text delimited file. See 'Text delimited'.

Curvature
The change in the degree of slope for a given distance on that slope.

Digital elevation model (DEM)


A three dimensional representation of a portion of the surface of the earth, represented in QGIS using
terrain data represented usually by points that correspond to different elevations.
Numerous kinds of DEMs exist.

Digitizing
The process of converting images into digital form that permits computer processing.

Dissolve
Separation of overlapping areas in the same layer.

Ellipsoid
In GIS, a regular oval shape, as a two dimensional representation of the globe as a spheroid.

EPSG code
A geodetic parameter dataset made up of coordinate reference systems (CRSs) that is widely available
online.

Field calculator
A tool for automatically calculating the area of a polygon.

- 135 -
Geographic coordinate system (GCS)
The earth is not a perfect sphere, despite being often depicted as such. Because of this, different
spheroid representations of the earth exist. Geographic coordinate systems use latitude and longitude
to measure and indicate locations on the globe, defined as a function of direction and distance from a
center point. Where representations of the globe however differ, so will the central point from which
coordinate systems are measured. This complicates use of different coordinate systems, especially
when they are to be compared, or data in one system is imported into a GIS basal layer that uses a
different system. This often requires transformation of the coordinate system to assure alignment in
the workspace.

Geographic Resources Analysis Support System (GRASS)


GRASS is an open-source GIS software suite with a high degree of flexibility, allowing the user to
process images, make maps, perform spatial analysis. The GRASS GIS homepage is
https://grass.osgeo.org/.

Georeference
To mark a location by tagging it with latitude and longitude values.

Google Earth
Google earth is a freely available online virtual map of the globe and GIS. The homepage for Google
Earth is https://www.google.com/earth/.

Graphical User Interface (GUI)


A computer format that allows the user to interact with the computer through visual indicators (e.g.,
menus, buttons, windows, fields). GUI formats contrast with the user having to type code.

Graticule
Networks of lines that when combined represent latitude and longitudes, as represented in a map.

Ground Control Point(s)


These are locations on the globe that have been delineated to geo-reference satellite derived data
precisely. These points have been accurately surveyed and are commonly used to correct for elevation
differences in observed measurements, and for other purposes to improve spatial accuracy.

Interpolation
The process of constructing new point data by relying on the range of discrete points available in a
given dataset.

Layer
Layer signifies different levels of information (for example shape files) that are arranged sequentially in
a geographical information system for viewing and spatial analysis.

Nearest Neighbor
An algorithm that interpolates adjacent elements to fill in surfaces with information.

One-dimensional lines
See 'polyline'.

Pan / Panning
To switch view between windows or images on a computer.

Profile-curve
A vertical measurement of the change of a slope over a given distance. Positive values indicate
convexity, while negative values represent concave profiles.

- 136 -
Plan curve
Measurement of the rate at which a horizontal curve changes. Positive and negative values, respectively
indicate divergence and convergence of a particular slope.

Plugin
Software that can be added or 'plugged in' to another piece of software.

Point
See 'Zero dimensional point'.

Point layer
A shapefile or layer that displays point data.

Point shapefile
Shapefile used to geo-locate and describe point features such as villages or cities.

Polygon
Polygons are two-dimensional geographical features covering a portion of the earth’s surface, for
example forests, lakes, administrative boundaries, farmers’ fields, or any other organizational unit the
user defines. Polygons are important because their area and perimeter can be measured.

Polyline
One-dimensional lines, also called polylines, are used to represent geographical features like rivers,
roads, railroads, trails, and topographic lines. Note that these features are linear in nature and do not
have area like polygons. Hence they can measure distance.

Progress bar
Located in the status bar, the progress bar shows progress of rendering as each layer is drawn to the
map view.

Projected coordinate system


Cartesian (X and Y coordinates) approaches are used to define locations in projected coordinate
systems, which consider the global as a flat, two dimensional surface based on a flattened
representation of a sphere on a flat plane, with geographical coordinate systems. This approach is
useful where accurate distance, angle, and area measurements are needed. The term ‘projection’ is
often used interchangeably with projected coordinate systems.

Raster (and Raster Data)


A particular type of geographical model. Using a grid format, it covers the space of each cell, the
smallest measurement unit in the in the grid, aligning it with a measured geographical feature in this
location. Combined into a matrix, a raster is a grid of cells.

Raster (and Raster Data)


A particular type of geographical model. Using a grid format, it covers the space of each cell, the
smallest measurement unit in the in the grid, aligning it with a measured geographical feature in this
location. Combined into a matrix, a raster is a grid of cells.

Raster algebra
The process of adding, subtracting, multiplying, or dividing data within raster files to create new
outputs.

Raster reclassification
The process of aggregating data values into specified data categories.

- 137 -
Re-project (re-projection)
To change the geographic coordinate system of a particular layer into another one.

Roughness
When comparing among the differences in cells in a raster and a central pixel, you are making a
comparison of roughness. This is useful for helping to determine the overall variation and frequency
of change in elevation in a DEM, or particular selected parts of a DEM.

Scene
Captured path image from a satellite or other aerial survey instrument.

Shape file
A popular geospatial vector data format for geographic information system GIS software. It is
developed and regulated by ESRI as an open specification for data interoperability among ESRI and
other GIS software products. A "shapefile" is actually a set of several files. Three individual files are
needed to store the core data that comprises a shapefile: .shp (shape format; the feature geometry),
.shx (shape index format; a positional index of the feature geometry to allow seeking forwards and
backwards quickly), and .dbf (attribute format; columnar attributes for each shape, in dBase IV format).
The actual shapefile relates specifically to .shp files, but alone are incomplete for distribution, as the
other supporting files are required.

Slope
Slope is the incline and steepness of a surface.

Shuttle Radar Topographic Mission (SRTM)


An international research collaboration that utilized satellite derived radar data to produce digital
elevation models (DEMs) and to catalogue topographical information.

Status bar
The status bar shows you your current position in map coordinates (e.g. meters or decimal degrees)
as the mouse pointer is moved across the map view.

System for Automated Geoscientific Analyses (SAGA)


A free and open source geographic information system used for editing spatial data.

Terrain Ruggedness Index (TRI)


The mean difference between a central pixel and its surrounding cells.

Text delimited
A data storage file in which each line of the file represents a different entry separated by a delimiter.
This allows data fields of any length that the user might want. In QGIS, text delimited file is an attribute
table. Each separate column has a separate and defined data character, and each row is independent.
The first row references column names.

Toggle
To switch between two modes, choices, or windows, or keys on a computer.

Vector
In vector data models, geographical features are represented using lines, points, and polygons. Vector
models conversely store date with discrete edges and boundaries, for example district or division
boundaries, country borders, road and river networks, etc.

- 138 -
Z-ordering
In the map layer, Z-ordering means that layers listed nearer the top of the legend are drawn over
layers listed lower down in the legend.

Zero-dimensional point
Considering mathematics, a zero-dimensional point is an abstraction of an object that can be
represented by latitude and longitude coordinates. Representative of geographical features like wells,
soil sampling locations, and so on,, that can be best expressed by a single reference point. These points
confer the least information about these file types, and are best to represent geographical data that
are very small scale and with limited area.

Zonal statistics
The zonal statistics function summarizes values of a selected raster within the zones that can be found
in another raster or vector dataset. The function reports the resulting data in tabular form or as a
vector layer file.

Zoom
To smoothly transition from a long-distance view to a close-up view, or vice versa, on a computer.

- 139 -
About the authors
Zia Uddin Ahmed
Dr. Ahmed has over 20 years of work experience in environmental
modeling and data analysis. His Areas of expertise include (1) data
mining, (2) geographic information systems (GIS), remote/proximal
sensing, and geostatistics (3) linear/non-linear model, mixed effect
model, multivariate statistics and machine learning and (4) database
management. He is currently a Research Associate Professor and
database and visualization specialist at the University of Buffalo’s
Research and Education in Energy, Environment and Water
(RENEW) Initiative. He holds a PhD in Soil Science from Cornell
University. Before RENEW, he worked for the International Maize
and Wheat Improvement Center (CIMMYT) as a Remote Sensing
Scientist in Bangladesh. Before CIMMYT, Dr. Ahmed also worked
for the Bangladesh Rice Research Institute (BRRI) and Cornell
University.

Timothy J. Krupnik
Dr. Timothy Krupnik is a Research Scientist and Systems
Agronomist with the International Maize and Wheat Improvement
Center’s (CIMMYT) Sustainable Intensification Program. He leads a
portfolio of applied research projects across South and South-East
Asia that deliver evidence-based knowledge and activities to improve
the sustainability and resilience of smallholder farming systems
considering agronomic, ecological, and socioeconomic objectives,
methods, and indicators. With core expertise in systems agronomy
and interests spanning socio-ecological systems analysis, climate
services, and science communication and extension, Timothy
prioritizes integrative, interdisciplinary, and multi-scale research. He
also serves as the overall CSISA coordinator for Bangladesh. Prior
to CIMMYT, Timothy was affiliated with the Africa Rice Center and
researched the agronomic, environmental and socioeconomic
consequences of water-saving irrigation technologies in West Africa.
He has also worked in East Africa and the Caribbean consulting for
donor agencies and NGOs.

Mustafa Kamal
Mustafa Kamal is a GIS and Remote Sensing professional with the
International Maize and Wheat Improvement Center’s (CIMMYT)
Sustainable Intensification Program. He has more than 8 years of
working experience and specializes in the effective and efficient use
of geospatial data applications across disciplines. With a background
in urban and rural planning and disaster management, he is expert
in the use of GIS, Remote Sensing (Optical, SAR, Thermal),
Unmanned Aerial Vehicle (UAV) technologies, and machine learning
algorithms for pixel and object based image analysis. He is also
interested in land use and land cover classification using machine
learning methods applied to remotely sensed data. Mustafa is
passionate about using cutting edge remote sensing science to
provide a better understanding of the complex relationships
between crop performance and environmental change, while
providing useful information and advisories for farmers.

- 140 -
Introduction to basic GIS and spatial analysis using QGIS:
Applications in Bangladesh

This book provides a set of learning modules introducing young scientists and researchers to
Geographic Information Systems (GIS) and spatial analysis using the open-source QGIS platform,
and complementary R, SAGA and GRASS Platforms. The modules can be used for self-directed
learning or to teach courses. Practical exercises that utilize spatial data for Bangladesh are included,
and all required spatial data can be downloaded from an open-source website. The modules provide
an overview of GIS, spatial data visualization techniques, and exercises in working with Global
Positioning System (GPS) data, tabular, and raster data. Students will also learn terrain and spatial
analysis, and also how to do georeferencing Google Earth image with QGIS and to develop new
vector datasets and digitizing. Exercises on how to produce aesthetically pleasing and informative
maps are also included. By the time students complete working with these modules, they should be
proficient in QGIS and spatial data analysis, and able to continue using these tools on an individual
basis without considerable extra coaching.

- 141 -

You might also like