You are on page 1of 16

GGY 283 Introductory Geographic Information Systems PRACTICAL 8

___________________________________________________________________________

Practical Exercise 8: Geospatial analysis techniques

Contents
PRE-PRAC VIDEOS ................................................................................................................................... 1
INTRODUCTION ....................................................................................................................................... 1
OBJECTIVES AND SKILLS ......................................................................................................................... 2
DATA AND SOFTWARE ............................................................................................................................ 2
ADDITIONAL HELP ................................................................................................................................... 2
MAIN TASKS ............................................................................................................................................ 3
1. TASK 1- GIS Basics: Explore data properties; set a CRS; project layers........................................... 3
1.1. Examine the data .................................................................................................................... 3
1.2. Re-project the two layers which are not in UTM 36S projection. .......................................... 4
2. TASK 2 – CREATE A STUDY AREA for a project ................................................................................ 5
2.1. Create a Fetakgomo polygon layer ......................................................................................... 5
2.2. Create the layer with the required vegetation land cover areas............................................ 6
2.3. Clip the vegetation areas ........................................................................................................ 7
2.4. Dissolve the boundaries .......................................................................................................... 7
3. TASK 3 – VECTOR DATA ANALYSIS – OVERLAY, SELECTION AND BUFFER ...................................... 7
3.1. Open a new QGIS project and add the relevant data layers: ................................................. 8
3.2. Spatial selection: Select by Location ....................................................................................... 9
3.3. Attribute selection (Attribute query) ...................................................................................... 9
3.4. Creating and using buffers .................................................................................................... 10
3.5. Select by Location and Inverting a selection......................................................................... 11
4. TASK 4 – DISPLAYING VECTOR DATA CATEGORIES AND PROCESSING UNION AND INTERSECT
OVERLAYS.............................................................................................................................................. 11
4.1. Find Area 1 (Overlay - Union)................................................................................................ 12
4.2. Find Area 2 (Overlay – Intersect) .......................................................................................... 13
5. TASK 5: EXAMINE and INTERPRET attribute FIELD STATISTICS ..................................................... 14
6. TASK 6: PRACTICAL 8 QUIZ ............................................................................................................ 16
CONCLUSION......................................................................................................................................... 16

PRE-PRAC VIDEOS
Prescribed: Videos 1 to 5 under Basic Spatial Analysis videos (available under Videos and help files
on clickUP)

INTRODUCTION
In this exercise you will explore a small selection of the many analysis tools offered in QGIS
Desktop. You will conduct basic spatial analysis procedures to answer spatial questions
based on different scenarios. Finally, you will use the understanding and skills that you
gained to complete an online quiz.

GGY 283 Copyright University of Pretoria 1


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

OBJECTIVES AND SKILLS


After completing the practical session, students should be able to:
a) Explore data properties using the QGIS Browser panel.
b) Re-project data layers when required.
c) Select data based on attributes (Attribute Selection).
d) Export selected features as a new layer.
e) Clip features based on the extent of another layer.
f) Use the dissolve function to aggregate/dissolve boundaries.
g) Create a buffer area around a feature.
h) Select/extract data based on spatial relationships (Spatial Selection).
i) Use the vector overlays (Union/Intersect) to analyse spatial data.
j) Examine and interpret attribute field statistics.
k) Select and use the appropriate data and processing tools to answer spatial questions.

DATA AND SOFTWARE


For this practical you will use the Fetakgomo training data set (Fetakgomo_data.zip) as available
under Practical Data on clickUP. You will use QGIS software for the Tasks.
Table 1: Data files and descriptions (This data set has been altered for training purposes and should NOT be used for any
other purpose. Many of the data layers were projected after being clipped – that is why they may look skew in your display)

File Name Description


F_Mainroad.shp Main roads
F_Municipality.shp Municipal boundaries
F_SchoolUTM.shp Schools
F_Substations Electricity sub stations
F_Tlines Electricity transmission lines
F_Wards Census wards in Fetakgomo area
FetaUseUTM.shp Land use types
FetaVegUTM.shp Vegetation (Vegetation Type = Acocks field; Land cover = LC_Value field)
FiresUTM Locations where veld fires occurred
Feta90mDem 90m Digital Elevation Model

For this project you can work with the shapefiles (and not the QGIS Geopackage format). That
means that you will save all outputs that you create “As a file” and then make sure that you save as
a shapefile.
Note: If you want to use the Geopackage format – you will have to change all
the data layers to that format. You may also pursue the Geopackage format in
the individual project later in the semester.

ADDITIONAL HELP
GGY 283 clickUP page – Videos and help files – QGIS videos and the QGIS manual.
The manual is also available online at https://docs.qgis.org/3.16/en/docs/user_manual/index.html.

GGY 283 Copyright University of Pretoria 2


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

MAIN TASKS
For this practical exercise you must complete SIX tasks:

1. TASK 1- GIS Basics: Explore data properties; set a CRS; project layers.
Purpose: This task is designed to review basic skills that you acquired in previous practical exercises.
Answer all the questions in this activity as you may need these insights in the subsequent clickUP
quiz. This activity covers:
 GIS Data properties – vector
 GIS Data properties – Raster
 GIS Data Attributes and Attribute tables.
1.1. Examine the data
I. Use the QGIS Browser window or panel to study the properties of each of the shapefiles
listed below, record/write down the geometry type and the number of features:
 F_SchoolUTM.shp
o Geometry: ……………….
o Number of features: …………….
 F_Mainroad.shp
o Geometry: ………….
o Number of features: ……………
 F_Municipality.shp
o Geometry: ……………….
o Number of features:
 FetaUseUTM.shp ……………………………
o Geometry: ………………..
o Number of features: ………….

II. Note the file format and pixel dimensions of the Feta90mDEM1.tif raster dataset below.
File format: …………………
Cell Dimensions: ………………..

III. Use the Browser window to check the coordinate system and projection under the Source
tab in the Layer Properties of all the data layers. Also check the Preview and Attributes tabs
for the layers.
IV. You will see that most of the layers are projected to EPSG: 32736 – WGS 84 / UTM zone 36S.
Two of the layers (the energy substations and transmission lines) are different and have a
geographic coordinate system and datum assigned, e.g.

Figure 1: Layer properties of the Energy substation dataset

GGY 283 Copyright University of Pretoria 3


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

1.2. Re-project the two layers which are not in UTM 36S projection.
Note: When using spatial analysis functions, the projection properties of the data layers must be
the same. Simply altering the projection information in the layer properties is not suitable and
will not alter the actual properties of the data layer - you must re-project these before starting
your new project.
You can do this separately for each layer or you can do a batch process to project both
layers at the same time:
In the QGIS menu bar, select Vector  Data Management Tools Reproject layer
Option 1: Re-projecting each layer separately

Figure 2: Re-projecting a single layer

a) Input layer is the Substations


b) Target CRS is EPSG:32736 – WGS 84 / UTM zone 36S
c) Save the Reprojected output to your data folder and give the layer a suitable
name.
d) Click on Run
e) Close when done
f) Repeat for the next layer
Option 2: Batch project more than one layer: (Don’t choose Autofill when prompted)

Figure 3: Re-projecting layers using a batch process

GGY 283 Copyright University of Pretoria 4


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

2. TASK 2 – CREATE A STUDY AREA for a project


Scenario: You have to create one study area polygon for a biodiversity project. Criteria: The study
area must include all areas in the Fetakgomo municipal area that also have a specific land cover
type.
In the Fetakgomo dataset, your study area for this project must only include:
 the Fetakgomo municipal region AND
 areas where the vegetation land cover category is “3” (LC=3).
You must create a study area without divisions.
Method summary: You will first select the Fetakgomo municipal area
and the land cover regions and create new layers from the
selections. Then you will Clip the relevant land cover regions to the
Fetakgomo boundary and dissolve the boundaries between the land
cover regions to create one single polygon as a study area.
Data required: Fetakgomo municipal regions and vegetation data
with the relevant land cover attributes.
Analysis model:

Figure 4: Example of an analysis model for solving this question

2.1. Create a Fetakgomo polygon layer


a) Add the Municipal boundaries layer (F_Municipality.shp) to a new empty QGIS project.
b) Navigate to the Fetakgomo data file in the Browser panel – right click and make it a favourite
link for the project.
c) Save the project in the data file with a suitable name, e.g. Fetakgomo Bio Study Area.
d) Right click on the F_Municipality layer and open the attribute table to identify the field
(column) that you can use to select the Fetakgomo area.

GGY 283 Copyright University of Pretoria 5


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

e) You can create a selection by selecting the record in the attribute table, or by applying an

attribute selection expression (Select Features by expression )

f) Right click on the municipality layer, choose Export and Save Selected Features As –
navigate to your data folder and give it a suitable, but short, name, e.g. FetaMuni. (In
earlier versions of QGIS – right click - choose Save as and make sure that you tick the option
to save only the selected feature)

2.2. Create the layer with the required vegetation land cover areas
a) Add the vegetation layer (FetaVegUTM36S.shp)
b) Then select the specified vegetation land cover areas where the LC_VALUE in the attribute
table equals 3. (You can use and Select by expression function or just select the records in
the attribute table.) The selected features is displayed in yellow:

c) Export the selected vegetation land cover zones as a new layer


(Save the layer as a shapefile in your data folder as you did previously
in #1.6)

GGY 283 Copyright University of Pretoria 6


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

2.3. Clip the vegetation areas


To identify the study area, you will clip the selected vegetation land cover zones that are in the
Fetakgomo municipal area. (Vector→Geoprocessing tools→Clip)
d) Select the land cover zones as Input, then select the Fetakgomo municipal area as the
Overlay layer and save the result as a file in your project data folder.

2.4. Dissolve the boundaries


e) Use the dissolve tool to remove the boundaries between the polygons so that you have one
study area polygon. (Vector→Geoprocessing tools→Dissolve) Name the resultant file (e.g.
StudyArea) and save the file in your data folder. Note: You may have to use this layer in the
P8 quiz later.

SAVE and CLOSE the PROJECT

3. TASK 3 – VECTOR DATA ANALYSIS – OVERLAY, SELECTION AND BUFFER


In this activity, you will be answer specific spatial questions using the following spatial analysis
methods:
 Select by Location-Intersection
 Select by Expression
 Buffering

The objective of this activity is to ensure that you understand how different types of vector analysis
can be applied in a geospatial analysis.
Notes:
1) Remember to constantly rename newly created map layers as you go through the different
processes. This will help you to keep track of what each layer represents.
2) In some cases you can make continuous selections on the same data set. If not, it is useful to
clear a previous selection before starting a new selection.

GGY 283 Copyright University of Pretoria 7


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

Scenario: The Sekhukhune district is implementing a project to urgently upgrade all primary schools
in the Fetakgomo municipal region that have no proper road access and water.
Research questions:
Question 1) Which schools in the Fetakgomo municipal region needs urgent upgrades?
Criteria: The schools must be:
 in the Fetakgomo municipal area AND the schools must be
 primary schools without water and with poor gravel road access.

Question 2) How many of the schools selected for upgrades in Question 1 are close to a main road
(within 5 km) and how many are further than 1km away from a main road?
a. Identify and locate schools for upgrade that are within five kilometres of a main road.
b. Identify and locate schools for upgrade that are further than five kilometres from a
main road.

Data required:
Schools, Main roads and the Fetakgomo region (as created in the previous task)
Analysis model:

Figure 5: Example of an analysis model towards solving a and b

3.1. Open a new QGIS project and add the relevant data layers:
Add the Fetakgomo area, the schools and the main roads. Save the project in your data
folder with a logical name, e.g. School upgrade project in Fetakgomo.

GGY 283 Copyright University of Pretoria 8


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

3.2. Spatial selection: Select by Location


Notice that the schools’ data (F_SchoolUTM.shp) covers more territory than the Fetakgomo area.
Therefore, you will use the Select by Location tool to extract the schools within the Fetakgomo area.
(Vector → Research Tools → Select by Location)

Note: The Clip function will render a similar result, but the output will be a new layer. The Select by
Location tool just creates a selection. You can save the selected features or continue working with the
active selection.

3.3. Attribute selection (Attribute query)


ii) How many of the schools in the Fetakgomo area (the selected schools), are primary
schools without water and poor road access (poor gravel)?
Tool: Select by Expression
"SCHOOLTYPE" = 'Primary' AND "WATER" = 'No' AND "ROADS" = 'Poor gravel'

NOTE: Make sure to select Filter Current Selection to select only the relevant schools from
the previous active selection of schools in the Fetakgomo area.

Do NOT try to count the selected schools – Open the attribute table and read from the top bar:

GGY 283 Copyright University of Pretoria 9


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

NB* Now create a new layer from this selection. Export and save the selected
features in your data folder and give the layer a suitable name e.g.
SchoolsForUpgrades. You will use it again later.

3.4. Creating and using buffers

Question: How many of the schools for upgrades are within a 5 km distance (buffer) from the
main road?

a. As your first step towards finding the answer, you will create a 5 km buffer around the
main Road

Tool: Vector  Geoprocessing tools  Buffer (Select the main road as the input, set the
distance and unit - select your Fetakgomo data folder for the output and give your layer
an appropriate name. Then select “Run”)

b. Display the main road above the buffer so that you can use the measure tool
to check whether the buffer process completed correctly.

c. Make some changes to the buffer symbol, e.g. set the Buffer layer transparency to 50%
or use a “hashed” symbol.

OR

NB* Keep the saved buffer layer, you will use it again later.

GGY 283 Copyright University of Pretoria 10


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

3.5. Select by Location and Inverting a selection


a. Now you want to find out which of these schools are within the 5 km (buffer) of the
main road and how many are further away.
Hint: There are different tools that you can use, but this time, we will use a Spatial
Selection to find the schools within the 5km buffer and then invert the selection to
find the relevant schools further away.
Tool: Vector→Research tools→Select by Location (intersect)
(Note: this selection is based on the location relationship between layers – that means
that we can refer to the process as a spatial query or Spatial Selection)

NB! Do not count on the screen! Read the answer from the relevant attribute table:

b. Now you must find a way to answer the following question yourself:
How many primary schools in the Fetakgomo municipal area are outside
the 5 km (buffer) from the main road?
Hint: You can invert the previous selection in the attribute table by using
the “Invert selection” option -
Or
You can try to use the Vector  Geoprocessing tools  Difference tool

Your final results could look something like this:

SAVE the PROJECT

4. TASK 4 – DISPLAYING VECTOR DATA CATEGORIES AND PROCESSING UNION


AND INTERSECT OVERLAYS.
In this activity, you will be answer specific spatial questions using the following spatial analysis
methods:
 Select by Expression
 Vector overlay method: Union
 Vector overlay method: Intersect

GGY 283 Copyright University of Pretoria 11


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

The objective of this activity is to ensure that you understand the difference between Union and
Intersect operations in a geospatial analysis.
Scenario: For community based programmes, you need to find two areas:

 Area 1: For an ecological project you need to identify an area / areas in the region where the
land use is Subsistence farming or the vegetation is Sourish mixed bushveld.

 Area 2: For an agricultural-community project you need to identify an area / areas in the
region where the land use Subsistence farming and the vegetation is Sourish mixed Bushveld,

4.1. Find Area 1 (Overlay - Union)


4.1.1. Explore the data required to solve the first problem (Finding Area 1).

4.1.2. Add the land use and vegetation data to a QGIS project (Use the same project as before
or start a new project).

Land use Vegetation

a) To understand your data better, display the types of land use and vegetation types
respectively.

Hint: Use Layer Properties  Symbology  Categorised  Classify (remember to


indicate the column in the attribute table on which you want the software to do the
classification)
b) Change the colours to more suitable representations, e.g.

4.1.3. To find the area (Area 1) where the land use is Subsistence farming or the vegetation is
Sourish mixed bushveld, you will use a Union function.

GGY 283 Copyright University of Pretoria 12


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

a) To use the union function with only the two relevant areas, you must first create these
areas as separate layers. (Hint: As in previous practical exercises - Use Select by Expression
 Export selection to a new layer and save the new layer with a suitable name in your data
folder)
b) Then use: Vector  Geoprosessing Tools  Union to complete the union overlay.

(Save the result as a shapefile, and with a suitable name, in your data folder)

Sourish Mixed bushveld Subsistence farming Result = Area 1

Union
(OR) =

4.2. Find Area 2 (Overlay – Intersect)


4.2.1. To find Area 2, where the land use is Subsistence farming and the vegetation is
Sourish mixed Bushveld, you will use the Intersect function

Note: To use an Intersect function with only the two relevant areas, you will use the
layers that you created as before

4.2.2.Then use: Vector  Geoprosessing Tools  Intersect to complete the intersect


overlay.

GGY 283 Copyright University of Pretoria 13


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

4.2.3. Save the result as a shapefile with a suitable name, in your data folder)

Sourish Mixed bushveld Subsistence farming Result = Area 2

Intersect
(AND) =

Note: Typically, an overlay using UNION will have a ’bigger’ output, but on the other
hand, an overlay using INTERSECT will have a reduced output.

5. TASK 5: EXAMINE and INTERPRET attribute FIELD STATISTICS


By examining the basic field statistics from quantitative data values in the attribute table of a layer, it
is possible to extract useful information. E.g.

5.1. Select the Schools layer in the layers panel.


5.2. Then choose Vector – Analysis Tools – Basic Statistics for Fields

5.3. Then select the Field to calculate statistics on (e.g. LEARNERS) and if you just want to get
an overview or lookup something, let it just “Save to a temporary file”.

GGY 283 Copyright University of Pretoria 14


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

5.4. Examine the result (note that there is an Html file that you can open as well):

For now, just examine the basics, e.g.


 Analysed field: LEARNERS
 Count: 262 (There are 262 schools in the data set)
 Unique values: 213 (There are some values that appear more than once – some schools may
have a similar number of learners)
 NULL (missing) values: 0 (There are no missing values - there is a value entered for all schools
– even if it is 0)
 Minimum value: 0 (There are schools with no learners or there may be schools with a value
of 0 entered by mistake)
 Maximum value: 1088.0 (The school(s) with the highest number of learners has 1088
learners)
 Range: 1088.0 (Data values goes up to 1088)
 Sum: 89470.0 (Total number of learners for all the schools in the dataset)
 Mean value: 341.48854961832063 (The average number of learners per school)
 Median value: 277.5 (The median value is somewhat below the mean – this means that the
number of schools that have fewer learners than the average per school, are more than the
number of schools that have more learners than the average per school.)

Note: Alternatively you may use the Show Statistical Summary tool in the
Attributes Toolbar. You still have to select the relevant layer and field.

GGY 283 Copyright University of Pretoria 15


GGY 283 Introductory Geographic Information Systems PRACTICAL 8
___________________________________________________________________________

6. TASK 6: PRACTICAL 8 QUIZ


Complete the P8 Practical Quiz on ClickUP (under Practical Classwork Assessments). You will be
required to apply the tools that you used in previous tasks to answer questions in the quiz. Note that
you may have to use different data layers and/or different inputs. Please read the questions
carefully! To help you prepare for the upcoming S2 assessment, the quiz has a time limitation but
you will have three attempts at completing the quiz before the due date.

CONCLUSION
In this practical exercise, you used several basic spatial analysis techniques to prepare data for analysis
and conduct the analysis. You explored and extracted data, conducted a dissolve operation, used
attribute and spatial selections and created a buffer. You applied spatial analysis tools in a logical
sequence to identify schools or areas based on certain criteria. Finally, you created overlays to answer
spatial questions.
Note: While none of these individual operations are necessarily complex, the sequence in
which they are combined will influence your workflow. The goal is to work as economically as
possible to achieve a result without any unnecessary steps.

END

GGY 283 Copyright University of Pretoria 16

You might also like