Gis Manual Final-1
Gis Manual Final-1
PRACTICAL - 1
AIM: - Creating and Managing Vector Data:
a) Adding vector layer
b) Setting properties
c) Vector Layer Formatting
d) Calculating line lengths and statistics
Procedure:
a. Adding vector layers (Polygon, Line, Points)
Polygon layers (We have taken 2 layers Matunga, Garden)
Line layers (We have taken 3 layers Small Roads, Road, Flyover)
Point layers (We have taken 4 layers bank, college, Restaurants, ATM)
b. Setting properties (Labeling, Symbolism)
1
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Following dialog box will appear on the screen. Select Polygon option from Geometry type.
2
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Field Panel
Add the Attribute you want to show. (Column Name for Table)
b. Specify Type (Data Type: Text Data/Decimal Data/Whole Number/Date) of Attribute
c. Specify the Length of the Attribute. Specify Precision (If Data Type is Decimal)
3
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
The CRS dialog box will appear on screen. Click on the WGS84 option and it will be
selected as follows. click on OK
4
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Click Toggle Editing Button Click on Add Polygon Now place the
cursor at the location where you want to place the polygon. for polygon layer minimum 3
points should be selected
Set style for polygon by using property window(Right click on Matunga Layer)
Following screen will appear on the screen. Select pattern as you want and click on OK.
5
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Same way we can add one more polygon layer for Gardens.
6
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Road layer :
To plot road click on Add Line Feature.
Once you are done then right click on map (Dotted line turn into solid line)
7
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
set style for Roads in the same way as we have done for polygon
8
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
To label your roads Right click on Road layer Go to properties window then select label
and set single label property
9
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
10
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
To merge roads
Go to properties of road then select symbology. Click on Advanced button
select Symbol levels.
11
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Final output:
12
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
"\GIS_Workshop\Practicals\Practical_01\D\DATA\IND_rrd\IND_rails.shp"
Press “ADD”
Also add India Administrative Map “GIS_Workshop\Practicals\
Practical_01\D\DATA\IND_adm\IND_adm0.shp”
Double Click on IND_adm0
Press OK
The display window will appear like
13
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Press Toggle Editing button using button, on Attribute table window toolbar.
14
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Set expression as
Press “OK”
A new column is added to the attribute table with value representing the length of track in KM.
15
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select IND_rails layer from input layer. And select Track_Len in “Field to Calculate
statistics on”
Press RUN
16
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
The Result is
17
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 2
Exploring and Managing Raster data:
a) Adding raster layers
From menu bar select Layer Add Layer Add Raster Layer
Select Gridded Population of the World (GPW) v3 dataset from Columbia University,
Population Density Grid for the entire globe in ASCII format and for the year 1990 and 2000. “\
GIS_Workshop\Practicals\Practical_02\A\Data\gl_gpwv3_pdens_90_ascii_one\glds90ag60.asc”
“\GIS_Workshop\Practicals\Practical_02\A\Data\gl_gpwv3_pdens_90_ascii_one\
glds00ag60.asc”
18
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
To start with analysis of population data, convert the pixel from grayscale to Color.
Select “glds90ag60.asc” Layer form layer Pane select property OR double click on it.
Select
Press “APPLY”
Repeat the same for “glds00ag60.asc” Layer
19
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
20
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select
Set Render Type to “Single band Pseudo color”, Interpolation as Discrete, and remove all
classification and add as shown in figure above using button. After all settings
press “OK”.
Layer will appear like
Explore an area of your choice and check the raster band value using to verify
the classification rule.
The red pixel shows negative changes and blue shows positive changes.
21
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
In many cases, there will be some overlap of the raster dataset edges that are being mosaicked
together, as shown below.
These overlapping areas can be handled in several ways; for example, you can choose to only keep
raster data from the first or last dataset, you can blend the overlapping cell values using a weight-
based algorithm, you can take the mean of the overlapping cell values, or you can take the
minimum or maximum value. When mosaicking discrete data, the First, Minimum, or Maximum
options give the most meaningful results. The Blend and Mean options are best suited for
continuous data. If any of the input rasters are floating point, the output is floating point. If all the
inputs are integer and First, Minimum, or Maximum is used, the output is integer.
22
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select the following “.tif” raster images for India from data
folder. FAS_India1.2018349.terra.367.2km.tif
FAS_India2.2018349.terra.367.2km.tif
FAS_India3.2018349.terra.367.2km.tif
FAS_India4.2018349.terra.367.2km.tif
Press open
In data source manager | Raster window click Add.
23
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
In Merge dialog window select a file name and location to save merged images.
24
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
You can now deselect individual layers from layer pane and only keep the merged raster file.
25
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select the merge raster image as input and Ind_adm0 as mask layer.
Press RUN.
After
Clippin
g
26
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 3
a) Making a Map
Create a new Thematic Map or open and existing one
Consider the following map as an example map
27
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
28
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
This will ensure that if any change in layers or change their styles, the Print Layout view will
not change.
Go to Add Item Add Picture Place a picture box at appropriate location.
29
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Add an inset Using Add Item Add Picture Select an area to be highlighted on main Map.
Set a frame for Inset by enabling the check box for Frame.
30
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
31
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Change the Label text To “Mumbai Map”, Set appropriate font size and color using
Item Properties Main Properties.
Add Item Add Legend Place the legend indicator at appropriate location.
Uncheck auto update and use suitable legend indicator label.
32
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
33
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
A Map can be saved in Image or PDF using Layout Export as Image / Export as PDF
34
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
35
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
36
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
37
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
c) Using Plugins
Core plugins are already part of the standard QGIS installation. To use these, just enable them.
Open QGIS. Click on Plugins Manage and Install Plugins....
To enable a plugin, check on the checkbox next to Plugin. This will enable the plugin to use it.
External plugins are available in the QGIS Plugins Repository and need to be installed by the
users before using them.
Click on Not Installed or Install from ZIP.
Once the plugin is downloaded and installed, you will see a confirmation dialog.
Click on Plugins <<new Plugin Name>>
The Plugin if marked Experimental plugin can be installed, from Setting check on
or
38
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
39
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
In OSM Place search Pane Enter Mumbai or any place name to search
Double click on the desired place in OSM Place search Panel or Click and press
Output:
40
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 4
A. Working with attributes
Start a new project.
Go to Layer Add Layer Add Vector Layer
Select “\GIS_Workshop\Practicals\Practical_04\A\Data\ne_10m_populated_places_simple.zip”
On clicking the Select feature using expression button the following window will appear.
Enter pop_max>100 and pop_max<10000 and click button to get all the places
with population between 100 and 10000.
41
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Will give
Use the deselect button to deselect the feature to be rendered in original color.
42
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
https://www.google.com/maps/@27.9857765,86.9285378,14.75z/data=!5m1!1e4?hl=en-US
Go to Layer Add Raster Layer select “10n060e_20101117_gmted_mea300.tif”,
from Data folder
43
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
The Lower altitude regions are shown using dark color and higher using light shade as seen
on top region containing Himalaya and Mt Everest.
Mt. Everest - is located at the coordinates 27.9881° N, 86.9253° E.
Enter 86.92, 27.98 in the coordinate field, Scale 900000 and Magnifier 100% at the bottom
of QGIS.
Crop the raster layer only for the region under study.
Go to Raster Extraction Clip Raster by Extent
44
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Press RUN.
Deselect the original layer and keep the clipped one.
The Clipped raster layer is representing altitude are from 103 Meters.
45
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select the input raster layer name. Set contour interval 100.00 meters, select the output
file name & location and check the option to add output file to project after processing.
Press “RUN”.
The contour layer will appear like this
46
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Label the layer using “ELEV” field and set appropriate symbols for line.
In the Layer panel right click on Contour Raster Layer and select “Open Attribute table”,
Arrange the table in descending order based on the value of “ELEV” column.
47
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Compare the above counter line raster layer with the previous Google map image or visit
https://www.google.com/maps/@27.9857765,86.9285378,14.75z/data=!5m1!1e4?hl=en-US
To verify the above contour files using Google Map
Make a copy of Contour Layer, Go to Layer Save As
Select file format as “Keyhole Markup Language”, set file name, location and Layer Name.
Also set CRS to WGS 84 EPSG:4326
48
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
A Hillshade is a grayscale 3D representation of the surface, showing the topographical shape of hills
and mountains using shading (levels of gray) on a map, just to indicate relative slopes, mountain ridges,
not absolute height.
For Hill Shade surface analysis
Go to Plugin Install Georeferencer GADL.
After successful installation of plugin Go to Raster Analysis Hill Shade
Select the input raster layer, select file name and location for storing Hill Shade output file.
49
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
50
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 5
Working with Projections and WMS Data
A Web Map Service (WMS) is a standard protocol developed by the Open Geospatial Consortium in
1999 for serving georeferenced map images over the Internet. These images are typically produced by a
map server from data provided by a GIS database
Start a new Project.
Layer Add Layer Vector Layer
Select “ne_10m_admin_0_countries.zip” Layer from data folder.
Go to Layer Save As
Select format as ESRI Shape File
Select folder location and file name
Set CRS North_America_Albers_Equal_Area_Conic EPSG: 102008
Press “OK”.
Deselect the original Image and keep the projected layer visible.
51
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
“GIS_Workshop\Practicals\Practical_05\DATA\minisc_gb\minisc_gb\data\RGB_TIF_compres
sed\MiniScale_(standard)_R17.tif”
The Layer appears on a different location than the location where Great Britain is shown
on Map.
Open Layer PropertiesCRS Search bri select British National Grid EPSG 27700.
Processing may take some time.
Locate United Kingdom on Layer; the vector layer exactly coincides by the raster
layer covering United Kingdom.
52
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 6
Georeferencing
A. Georeferencing Topo Sheets and Scanned Maps
Start a new project
Go to Layers Add Layer Add vector Layer
Select GIS_Workshop\Manual\Prac06\IND_adm0.shp
Zoom in to Mumbai region in the layer.
53
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
54
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
55
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Press “RUN”
In Georeferencing window go to File Start Georeferencing
The canvas area will now have the scanned map of Mumbai referenced with control points.
Select the newly added layer in Layer Panel Right click and go to property.
56
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Output:
57
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
58
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Go to Raster Georefrencer
59
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
60
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Observe that the aerial image of the Gateway of India is georeferenced on OSM in the
map canvas.
61
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
QGIS offers a simple solution to make raster load much faster by using Image Pyramids.
Right-click the Christchurch Topo50 map.tif layer and select Properties.
Choose the Pyramids tab. Hold the Ctrl key and select all the resolutions offered in
the Resolutions panel.
62
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Press OK.
63
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Once the layer is loaded, click the Toggle Editing button to put the layer in editing mode.
Click the Add feature button. Click on the map canvas to add a new vertex.
Add new vertices along the road feature. Once you have digitized a road segment, right-click to
end the feature.
On Layer Panel Right Click on Digitze_Road, Select the Style tab in the Layer
Properties dialog.
64
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Result
Select appropriate style to see the digitized road feature clearly.
65
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select Digitized_Garden layer in Layer Panel and click on Toggle Editing button
66
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 7
Managing Data Tables and Saptial data Sets:
a) Table joins
Start a new project
Go to Layer Add Layer Add new Vector Layer “I:\
GIS_Workshop\Practicals\Practical_07\A\Data\tl_2013_06_tract.zip”
We could import this csv file without any further action and it would be imported. But, the default
type of each column would be a String (text). That is ok except for the D001 field which contains
numbers for the population. Having those imported as text would not allow us to run any
mathematical operations on this column. To tell QGIS to import the field as a number, we need to
create a sidecar file with a .csvt extension.
This file will have only 1 row specifying data types for each column. Save this file as
ca_tracts_pop.csvt in the same directory as the original .csv file.
Go to Layer Add Layer Add Delimited Text Layer
And add I:\GIS_Workshop\Practicals\Practical_07\A\Data\ca_tacts_pop.csv”
In the layer panel, Right click on “tl_2013_06_tract”, layer and select Properties
67
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Select the option in Properties, and click on button to add new table join.
In the Add Vector Join window set the following properties and click OK.
For more clear output, select “tl_2013_06_tact” from Layer Panel, right click and
select properties. Go to Symbology and set the following properties.
68
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
A detailed and accurate population map of California can be seen as the result. Same
technique can be used to create maps based on variety of census data.
69
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
b) spatial joins
Go to Layer Add Layer Add Vector Layer Select “I:\GIS_Workshop\Practicals\
Practical_07\B\Data\nybb_12c\nybb_13c_av\nybb.shp” and “I:\GIS_Workshop\Practicals\
Practical_07\B\Data\OEM_NursingHomes_001\OEM_NursingHo mes_001.shp”, from data
folder.
70
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Use the Identify Feature Button to select a region to view join data on map Layer.
Output
71
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
72
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Use the select Feature button to check country wise counting of Earthquakes.
Also a new column is added to attribute table “NumPoints” indicating number of earth
quake points in each country.
73
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Open project Properties Set CRS “World_Azimuthal_Equidistant EPSG 54032” . The map
will be re-projected as
74
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
75
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
This will highlight only those rivers containing a populated place within 2 KM
76
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 8
Advanced GIS Operations 1:
a) Nearest Neighbor Analysis
Go to Layer add Layer add Delimited Text Layer and load “signif.txt” from data file.
Go to Layer Add Layer Add vector Layer and from data folder “\GIS_Workshop\
Practicals\Practical_08\A\DATA\ne_10m_populated_places_simple.zip” load the layer to the
project and remove all rows from attribute table other than India.
77
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
78
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
1. Here select the earthquake layer signif as the Input point layer and the populated
places ne_10m_populated_places_simpleas the target layer. You also need to select a unique
field from each of these layers which is how your results will be displayed. In this analysis, we
are looking to get only 1 nearest point, so check the Use only the nearest(k) target points, and
enter 1. Name your output file matrix.csv, and click OK. Once the processing finishes,
click Close.
79
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
2. Once the processing finishes, click the Close button in the Distance Matrix dialog. You can
now view the matrix.csv file in Notepad or any text editor. QGIS can import CSV files as well,
so we will add it to QGIS and view it there. Go to Layer ‣A d d Layer ‣A d d Delimited Text
Layer....
3. Browse to the newly created matrix.csv file. Since this file is just text columns, select
No geometry (attribute only table) as theGeometry definition. Click OK.
80
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
4. You will see the CSV file loaded as a table. Right-click on the table layer and select
Open Attribute Table.
5. Now you will be able to see the content of our results. The InputID field contains the field
name from the Earthquake layer. The TargetID field contains the name of the feature from the
Populated Places layer that was the closest to the earthquake point. The Distance field is the
distance between the 2 points.
81
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
6. This is very close to the result we were looking for. For some users, this table would be
sufficient. However, we can also integrate this results in our original Earthquake layer
using a Table Join. Right-click on the Earthquake layer, and select Properties.
8. We want to join the data from our analysis result to this layer. We need to select a field
from each of the layers that has the same values. Select matrix as the Join layer` and
InputID as
82
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
the Join field. The Target field would be I_D. Leave other options to their default values and
click OK.
9. You will see the join appear in the Joins tab. Click OK.
10. Now open the attribute table of the signif layer by right-clicking and selecting Open
Attribute Table.
83
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
11. You will see that for every Earthquake feature, we now have an attribute which is the
nearest neighbor (closest populated place) and the distance to the nearest neighbor.
84
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
12. We will now explore a way to visualize these results. First, we need to make the table
join permanent by saving it to a new layer. Right-click the signif layer and select Save
As....
13. Click the Browse button next to Save as label and name the output layer
as earthquake_with_places.shp. Make sure the Add saved file to map box is checked and
click OK.
85
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
14. Once the new layer is loaded, you can turn off the visibility of the signif layer. As our dataset is
quite large, we can run our visualization analysis on a subset of the data. QGIS has a neat
feature where you can load a subset of features from a layer without having to export it to a
new layer. Right-click the earthquake_with_places layer and select Properties.
15. In the General tab, scroll down to the Feature subset section. Click Query Builder.
16. For this tutorial, we will visualize the earthquakes and their nearest populated places
for Mexico. Enter the following expression in the Query Builder dialog.
86
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
"COUNTRY" = 'MEXICO'
23. You will see that only the points falling within Mexico will be visible in the canvas. Let’s do
the same for the populated places layer. Right-click on
the ne_10m_populated_places_simple layer and select Properties.
87
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
24. Open the Query Builder dialog from the General tab. Enter the following
expression. "adm0name" = 'Mexico'
88
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
25. Now we are ready to create our visualization. We will use a plugin named MMQGIS. Find
and install the plugin. See Using Pluginsfor more details on how to work with plugins. Once
you have the plugin installed, go to MMQGIS ‣Create ‣H u b Lines.
26. Select ne_10m_populated_places_simple as the Hub Point Layer and name as the Hub ID
Attribute. Similarly, selectearthquake_with_places as the Spoke Point Layer and matrix_Tar as
the Spoke Hub ID Attribute. The hub lines algorithm will go through each of earthquake points
and create a line that will join it to the populated place which matches the attribute we
specified. Click Browse and name the Output Shapefile as earthquake_hub_lines.shp. Click OK
to start the processing.
89
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
27. The processing may take a few minutes. You can see the progress on the bottom-left corner
of the QGIS window.
28. Once the processing is done, you will see the earthquake_hub_lines layer loaded in QGIS. You
can see that each earthquake point now has a line that connects it to the nearest populated
place.
90
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Many scientific and environmental datasets come as gridded rasters. Elevation data (DEM) is
also distributed as raster files. In these raster files, the parameter that is being represented is
encoded as the pixel values of the raster. Often, one needs to extract the pixel values at certain
locations or aggregate them over some area. This functionality is available in QGIS via two
plugins - Point SamplingTool and Zonal Statistics plugin.
Procedure
1. Go to Layer ‣A d d Raster Layer and browse to the
downloaded us.tmax_nohads_ll_{YYYYMMDD}_float.tif file and click Open.
2. Once the layer is loaded, select the Identify tool and click anywhere on the layer. You will
see the temperature value in celsius as the value or Band 1 at that location.
91
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
4. In the Create a Layer from Delimited Text File dialog, click Browse and
open 2013_Gaz_ua_national.txt. Choose Tab under Custom delimiters. The point coordinates
are in Latitude and Longitude, so select INTPTLONG as X field and INTPTLAT as Y field.
Check the Use spatial index box and click OK.
92
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
5. Now we are ready to extract the temperature values from the raster layer. Install
the Point Sampling Tool plugin. See Using Plugins for details on how to install plugins.
6. Open the plugin dialog from Plugins ‣Analyses ‣Point sampling tool.
93
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
7. In the Point Sampling Tool dialog, select 2013_Gaz_ua_national as the Layer containing
sampling points. We must explicitely pick the fields from the input layer that we want in the
output layer. Choose GEOID and NAME fields from the2013_Gaz_ua_national layer. We
can sample values from multiple raster band at once, but since our raster has only 1 band,
choose the us.tmax_nohads_ll_{YYYYMMDD}_float: Band 1. Name the output vector layer
as max_temparature_at_urban_locations.shp. Click the OK to start the sampling process.
Click Close once the process finishes.
94
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
9. First part of our analysis is over. Let’s remove the unnecessary layers. Hold the Shift key and
select max_temparature_at_urban_locations and 2013_Gaz_ua_national layers. Right-click
and select Remove to remove them from QGIS TOC.
95
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
13. In the Save Vector layer as.. dialog, click Browse and name the output file as counties.shp.
Choose Selected CRS from the CRS dropdown menu. Click Browse and select WGS 84 as
the CRS. Check the Add saved file to map and click OK.
96
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
15. Enable the Zonal Statistics Plugins. This is a core plugin so it is already installed. See
Using Plugins to know to how enable core plugins.
97
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
18. The analysis may take some time depending on the size of the dataset.
19. Once the processing finishes, select the counties layer. Use the Identify tool and click on
any county polygon. You will see three new attributes added to the
layer: ZS_count, ZS_mean and ZS_sum. These attributes contain the count of raster pixels,
mean of raster pixel values and sum of raster pixel values respectively. Since we are
interested in average temperature, the ZS_meanfield will be the one to use.
98
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
20. Let’s style this layer to create a temperature map. Right-click the counties layer
and select Properties.
21. Switch to the Style tab. Choose Graduated style and select ZS_mean as the Column.
Choose a Color Ramp and Mode of your chose. Click Classify to create the classes.
Click OK.
99
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
22. You will see the county polygons styled using average maximum temperature extracted
from the raster grid.
100
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
4. You will see the 2 layers loaded in QGIS. The Boundary2004_550_stpl83 layer represents
the boundary of the lake. Un-check the box next to it in the Table of Contents.
5. This will reveal the data from the second layer Arlington_Soundings_2007_stpl83. Though
the data looks like lines, it is a series of points that are very close.
101
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
6. Click the Zoom icon and select a small area on the screen. As you zoom closer, you will see
the points. Each point represents a reading taken by a Depth Sounder at the location recorded
by
a DGPS equipment.
7. Select the Identify tool and click on a point. You will see the Identify Results panel show up on
the left with the attribute value of the point. In this case, the ELEVATION attribute contains
the
depth of the lake at the location. As our task is to create a depth profile and elevation contours,
we will use this values as input for the interpolation.
8. Make sure you have the Interpolation plugin enabled. See Using Plugins for how to
enable plugins. Once enabled, go toRaster‣Interpolation ‣Interpolation.
9. In the Interpolation dialog, select Arlington_Soundings_2007_stpl83 as the Vector layers
in the Input panel. Select ELEVATION as the Interpolation attribute. Click Add. Change
the Cellsize X and Cellsize Y values to 5. This value is the size of each pixel in the output grid.
Since our source data is in a projected CRS with Feet-US as units, based on our selection, the
grid size will be 5 feet. Click on the ... button next to Output file and name the output file
as elevation_tin.tif. CLick OK.
103
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
10. You will see the new later elevation_tin loaded in QGIS. Right-click the layer and select
Zoom to layer.
11. Now you will see the full extent of the created surface. Interpolation does not give accurate
results outside the collection area. Let’s clip the resulting surface with the lake boundary.
Go to Raster ‣Extraction ‣Clipper.
12. Name the Output file as elevation_tin_clipped.tif. Select the Cliiped mode as Mask
layer. Select Boundary2004_550_stpl83 as the Mask layer`. Click OK.
104
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
13. A new raster elevation_tin_clipped will be loaded in QGIS. We will now style this layer
to show the difference in elevations. Note the min and max elevation values from
the elevation_tin layer. Right-click the elevation_tin_clipped layer and select Properties.
14. Go to the Style tab. Select Render type as Singleband pseudocolor. In the Generate new color
map panel, select Spectralcolor ramp. As we want to create a depth-map as opposed to a
height- map, check the Invert box. This will assign blues to deep areas and reds to shallow
areas.
Click Classify.
105
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
15. Switch to the Tranparency tab. We want to remove the black-pixels from our output. Enter 0
as the Additional no data value. Click OK.
16. Now you have a elevation relief map for the lake generated from the individual depth
readings. Let’s generate contours now. Go to Raster ‣Extraction ‣Contours.
17. In the Contour dialog, enter contours as the Output file for contour lines. We will
generate contour lines at 5ft intervals, so enter 5.00 as the Interval between contour lines.
Check the Attribute name box. Click OK.
18. The contour lines will be loaded as contours layer once the processing is finished. Right-
click the layer and select Properties.
19. Go to the Labels tab. Check the Label this layer with box and select ELEV as the
field. Select Curved as the Placement type and click OK.
20. You will see that each contour line will be appropriately labeled with the elevation along
the line.
107
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Practical 9
Automating Complex Workflows using Processing Modeler
Procedure
Our workflow for this exercise will have the following steps.
Apply a Majority Filter algorithm to the input landcover raster. This will reduce noise in
our output by eliminating isolated pixels.
Convert the resulting raster to a polygon layer.
Query for a class value from the attribute table of the polygon layer and create a vector layer
for that class.
The following steps outline the process to code the above process into a model and run it on the
downloaded datasets.
1. Launch QGIS and go to Processing ‣ Graphical Modeler....
2. The Processing modeler dialog contains a left-hand panel and a main canvas.
Select the Inputs tab in the left-hand panel and drag the + Raster layer to the
canvas.
3. A Parameter definition dialog will pop-up. Enter Input as the Parameter name
and mark Yes to Required. Click OK.
108
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
4. You will see a box with the name Input appear in the canvas. This represents the
landcover raster that we will use as input. Next step is to apply a Majority filter algorithm.
Switch to the Algorithm tab from the bottom-left corner. Search for the algorithm and you
will find it listed under SAGA provider. Drag it to the canvas.
Note
If you do not see this algorithm or any of the subsequent algorithms mentioned in thi tutorial, you may
be using the Simplified Interface of the Processing Toolbox. Switch to the Advanced Interface by
using the dropdown at the bottom of the Processing Toolbox in the main QGIS window.
5. A configuration dialog for Majority Filter will be presented. Leave the values to their
default and click OK.
109
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
6. You will note that there is now a new box named Majority Filter in the canvas and it is
connected to the Input box. This is because the Majority Filter algorithm uses the Input raster
as its input. The next step in our workflow is to convert the output of majority filter to vector.
Find the Polygonize (raster to vector) algorithm and drag it to the canvas.
Note
The boxes can be moved and arranged by clicking on it and dragging it while holding the left mouse
button. You can also use the scroll-wheel to zoom in and out in the model canvas.
7. Select ‘Filtered Grid’ from algorithm ‘Majority Filter’ as the value for Input layer. Click OK.
110
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
8. The final step in the workflow is to query for a class value and create a new layer from
the matching features. Search for the Extract by attribute algorithm and drag it the
canvas.
9. Select ‘Vectorized’ from algorithm ‘Polygonize (raster to vector) as the Input Layer. We want
to extract the pixels that represent Croplands. The corresponding pixel value for this class will
be 12. (see Code Values). Enter DN as the Selection attribute and 12as the value. As the
output
111
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
of this operation will be the final result, we need to name the output. Enter vectorized class as
the Output.
10. Enter the Model name as vectorize and Group name as raster. Click the Save button.
12. Now it is time to test our model. Close the modeler and switch to the main QGIS window.
Go to Layer ‣ Add Layer ‣ Add Raster Layer....
13. Browse to the downloaded LC_hd_global_2001.tif.gz file and click Open. Once the raster
is loaded, go to Processing ‣ Toolbox.
113
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
14. Find the newly created model under Models ‣ raster ‣ vectorize. Double-click to launch
the model.
114
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
16. You will see all the steps being executed without any user input. Once the processing finishes,
a new layer vectorized_classwill be added to QGIS. Let’s improve the model a little bit. Right-
click on the vectorize model and select Edit model.
17. In Step 12, we hard-coded the value 12 as the class value. Instead, we can specify it as a
input parameter which the user can change. To add this, switch to the Inputs tab and drag the
+ String to the model.
115
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
18. Enter the Parameter Name as Class. Enter 12 as the Default value.
19. We will now change the Extract by attribute algorithm to use this input instead of the
hard- coded value. Click the Edit button next to the Extract by attribute box.
116
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
20. Click the dropdown arrow for Value and select Class. Click OK.
21. You will see from the model diagram that the Extract by attribute algorithm now uses 2
inputs. The modeler has a shortcut to launch the model and test it. Click the Run button from
the toolbar.
22. Notice that the model dialog has a new editable field called Class. Enter 16 as the Class
value and click Run.
117
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
23. Once the processing finishes, you will see that with just a click of a button we were able to run
a complex workflow and extract the area for class 16.
118
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
24. Now that our model is ready, we can run it just as easily on a new raster layer. Load
the LC_hd_global_2012.tif.gz file by going to Layer ‣ Add Layer ‣ Add Raster Layer...Click
the vectorize` model from the Processing Toolbox panel.
25. Pick the LC_hd_global_2012 layer as the Input and click Run.
26. Once the new output is loaded, you can compare the changes in the Croplands from 2001
to 2012.
119
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
27. It is always a good idea to add documentation to your model. The modeler has a built-in Help
editor that allows you to embed help directly in the model. Right-click the vectorize model
and select Edit model.
28. Click the Edit model help button from the toolbar.
120
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
29. In the Help editor dialog, select any item from the Select element to edit panel and enter the
help text in Element description. Click OK. This help will be available in the Help tab when
you launch the model to run.
121
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
PRACTICAL - 10
A. Validating map data.
AIM: To validate Map data using Excel and QGIS.
Software Used: QGIS Desktop 3.4.2 and Microsoft Excel 2013.
Datasets Used: The following datasets are used
1. Kenya_epidemiological_data.xls
2. Kenya_epidemiological_dict.xl
s Shape Files used: Kenya admin.
Theory
The aim of this practical is to focus on the validation steps that should be performed during data
cleaning. These include three types of checks:
1. Structural checks: e.g. unique ID, duplicates, format
2. Validation of plausibility - possible range of values e.g. min/max expected age
3. Logical checks - inconsistencies in answers e.g. occupation/age
The practical will be conducted using Microsoft Excel and QGIS software. The practical will be
performed in the following stages
1. Developing a data cleaning plan
2. Performing Structural data checks
3. Verifying the plausibility of data
4. Performing Logical data checks
5. Verifying coordinates of mapping data
6. Preparing data for mapping.
Procedure
The following steps we need to perform in the Stage I of developing a data cleaning plan
1. Open the “Kenya_epidemiological_data.xls” in Microsoft Excel. Additionally open the
corresponding dictionary “Kenya_epidemiological_dict.xls”, which contains a description of
all variables and information about their coding.
2. You should make note of the number of entries in your database, as you will need to keep
track of any changes e.g. when you remove duplicates at a later stage.
The following steps we need to perform in the Stage II of performing Structural Data checks
A. Format of the Database
B. Removing Duplicates
C. Coding of variables
2A Format of the database
Open Kenya_epidemiological_data.xls in excel.
Go to the View tab, click Freeze Panes and choose Freeze Top Row.
122
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now select the first combo box and select Duplicate and select Light red fill with Dark red text in the
next combo box as shown in figure
2B Removing Duplicates
Select all the columns of existing worksheet
Now go to Data Tab and select Remove Duplicates
123
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
2C Coding of variables
In the current worksheet, select the sex column.
Now type Ctrl+F and use Replace Function and Replace as
follows M-1
F-2
Please keep track of how many values are getting replace.
124
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
125
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
126
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
An empty table is inserted in a new sheet and a window will open on the right hand side named PIVOT
TABLE FIELD LIST.
From the PivotTable Field List, drag the “stool” item and drop it into the “Row Label” field as show
above.
Similarly, Click on anysth_inf and draw it into the “Column labels” and “Σ Values” field.
To include the count of observations in the table you might need to change the value field settings to
count.
Click on the combo box Sum of stools and Click on Value Field Settings.
Change the value in Summarize value filed by to Count and click OK. Table is updated with count
values as shown below
4B Formulas
Open the existing worksheet
Create a new column with the variable called check
Type the following formula in S2 column of worksheet =IF(AND(H2=0, NOT(P2="")),1,0)
127
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now copy the formula to all other cells (ensure that the formula is copied to all rows in your dataset)
Now use the filter to show only entries with a check value of 1.
Here we have to add file: Kenya_school_location.csv. In the Geometry Definition section, there is a
field called Geometry CRS, in that we have to select WGS84 as coordinate system.
As you can see 2 points are not on the map.
To examine this, we need to save these layers as a Shapefile, to do that select both the layers
Kenya_school_location and Kenya admin, then right click on them and choose Save Features As…
128
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
In the menu that comes up, set Format as ESRI Shapefile and put File Name as
Kenya_schools.shp After this is done you can uncheck the Kenya_school_location in the layers
section.
Let’s try and get the details of these 2 points that are not on the map, select the Kenya_schools
layer, click on the Identify Features Tool button and then click on the points outside of Kenya to
get their details.
129
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now we want to add the district information to the map. Therefore, we will join information based on
the geographical localization.
In the menu click on Vector, then Data Management Tools, then select Join attributes by location.
130
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
We also need to save the output so in Joined Layer, click “…”button to Browse location.
Save as Kenya_school_district.csv
131
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
We need to change the co-ordinate of those 2 points which were not on the map. So, open the
file
Kenya_school_location.csv and make the following changes, set:
IBWALI: Longitude 34.6459198
SIWOT: Longitude 35.35437012
132
Created By: Ritik Pandey Roll No.: 102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now click on school_idtodragand drop it in the “Row labels” field at the bottom.
Add district_id to“Σ Values”and click on it, a drop down list will open, click on Value Field
Settings. Choose Average as type of calculation, because all children in the same school will have
same district_id.
133
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now drag and dropchild_id into the “Σ Values” field, click on Value Field Settings and choose
Count to summarize the results. So, we come to know how many children per school are infected.
Similarly, Drag and dropanysth_inf into the field, click on Value Field Settingsand choose Sum. As,
infected is 1 and not affected is 0, the sum will give us the total number of infected children.
Now copy the table, open a new Excel file and paste the values into the new spreadsheet. Therefore,
click Paste in the Home tab, then choose Paste special and paste only the values.
Remove the last row which has Grand Total and other values.
134
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now we need to know the total count of infected children, that is, the prevalence of STH.
So, w ecreate a new column:sth_previn which we are going to be dividing the number of infected
children by the number of children and multiplying by hundred to obtain a value in percent (%).
In the first cell under the heading type =F2/C2*100 (this assumes that your number of children is in
row C and the number of infected children in row F; you will need to adjust the column label
accordingly); then copy the formula to the other cells in the column.
Additionally, you could calculate the 95% confidence interval (CI) of your prevalence.
You will have to create a new column called “CIlow” (lower confidence limit) and “CIup”(upper
confidence limit)
You can calculate the limits by typing the formulas as follows and then copying to the other cells:
For CIlow: =I2 - (1.96*(SQRT((I2*(100-I2)/C2))))
For CIup: =I2 + (1.96*(SQRT((I2*(100-I2)/C2))))
Assuming I2 as sth_prev and C2 as Count of child_id, adjust accordingly.
135
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Now that all the datasets are ready, let’s add them.
Open a new QGIS project.
First, add Kenya_school_location2.csv to the project. Click on Add Delimited text layer in the menu,
and browse to select the file.
136
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
137
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
Go to the Joins section and click on the plus(+) button at the bottom
138
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
For “Join layer” chooseKenya_epidemiological_school and for“Join field” and “Target field” choose
school_id. Then click on OK.
139
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
140
Created By: Ritik Pandey Roll No.:
102
T.Y.B.Sc.I.T. Sem VI Principles of Geographic Information Systems
--------------------------
142
Created By: Ritik Pandey Roll No.:
102