Practical Manual 2025
Practical Manual 2025
Practical Manual
2025
http://www.samapsandflags.co.za/Maps.htm
Table of Contents
PRACTICAL 1: Creating and Exploring a Basic Map ........................................................................... 2
PRACTICAL 2: Symbology..................................................................................................................... 16
PRACTICAL 3: Vector Data ................................................................................................................... 34
PRACTICAL 4: Laying Out the Maps ................................................................................................... 52
EXERCISE ................................................................................................................................................ 62
CREDITS ................................................................................................................................................... 63
1
PRACTICAL 1: Creating and Exploring a Basic Map
In this practical, you will create a basic map which will be used later as a basis for further
demonstrations of QGIS functionality. The following topics are covered:
1.1. An Overview of the Interface
1.2. Adding Your First Layer
1.3. Navigating the Map Canvas
2
The Layers List
In the Layers list, you can see a list, at any time, of all the layers available to you.
Expanding collapsed items (by clicking the arrow or plus symbol beside them) will provide you
with more information on the layer’s current appearance.
Hovering over the layer will give you some basic information: layer name, type of geometry,
coordinate reference system and the complete path of the location on your device.
Right-clicking on a layer will give you a menu with lots of extra options. You will be using some
of them before long, so take a look around!
Note: A vector layer is a dataset, usually of a specific kind of object, such as roads, trees, etc. A
vector layer can consist of either points, lines or polygons.
The Browser Panel
The QGIS Browser is a panel in QGIS that lets you easily navigate in your database. You can have
access to common vector files (e.g. ESRI Shapefile or MapInfo files), databases (e.g. PostGIS,
Oracle, SpatiaLite, GeoPackage or MS SQL Server) and WMS/WFS connections. You can also
view your GRASS data.
If you have saved a project, the Browser Panel will also give you quick access to all the layers
stored in the same path of the project file under in the Project Home item.
Moreover, you can set one or more folder as Favorites: search under your path and once you have
found the folder, right click on it and click on Add as a Favorite. You should then be able to see
your folder in the Favorites item.
Tip: It can happen that the folders added to Favorite item have a really long name: don’t worry
right-click on the path and choose Rename Favorite... to set another name.
Toolbars
Your most often used sets of tools can be turned into toolbars for basic access. For example,
the Project toolbar allows you to save, load, print, and start a new project. You can easily
customize the interface to see only the tools you use most often, adding or removing toolbars as
necessary via the View ► Toolbars menu.
Even if they are not visible in a toolbar, all of your tools will remain accessible via the menus. For
example, if you remove the Project toolbar (which contains the Save button), you can still save
your map by clicking on the Project menu and then clicking on Save.
The Map Canvas
This is where the map itself is displayed and where layers are loaded. In the map canvas you can
interact with the visible layers: zoom in/out, move the map, select features and many other
operations that we will deeply see in the next sections.
3
The Status Bar
Shows you information about the current map. Also allows you to adjust the map scale, the map
rotation and see the mouse cursor’s coordinates on the map.
The Side Toolbar
By default the Side toolbar contains the buttons to load the layer and all the buttons to create a new
layer. But remember that you can move all the toolbars wherever it is more comfortable for you.
The Locator Bar
Within this bar you can access to almost all the objects of QGIS: layers, layer features, algorithms,
spatial bookmarks, etc. Check all the different options in the Locator settings section of the QGIS
User Manual.
Tip: With the shortcut Ctrl+K you can easily access the bar.
Task 1
Try to identify the four elements listed above on your own screen, without referring to the diagram
above. See if you can identify their names and functions. You will become more familiar with
these elements as you use them in the coming days.
1.1.Try to find each of these tools on your screen. What is their purpose?
a)
b)
c)
d) Render
e)
f)
Note: If any of these tools is not visible on the screen, try enabling some toolbars that are currently
hidden. Also keep in mind that if there isn’t enough space on the screen, a toolbar may be shortened
by hiding some of its tools. You can see the hidden tools by clicking on the double right arrow
button in any such collapsed toolbar. You can see a tooltip with the name of any tool by holding
your mouse over the tool for a while.
Now that you are familiar with the basics of the QGIS interface, in the next lesson we will see how
to load some common data types.
1.2. Adding your first layers
We will start the application, and create a basic map to use for examples and exercises.
The goal for this practical: To get started with an example map.
4
Before starting this exercise, QGIS must be installed on your computer. Launch QGIS from its
desktop shortcut, menu item, etc., depending on how you configured its installation.
Prepare a map
1. Open QGIS. You will have a new, blank map.
2. The Data Source Manager dialog allows you to choose the data to load depending on the
Open Data Source Manager
data type. We’ll use it to load our dataset: click the button.
If you can’t find the icon, check that the Data Source Manager toolbar is enabled in the View
► Toolbars menu.
5
3. Load the protected_areas.shp vector dataset:
1. Click on the Vector tab.
6. Click Add here as well. The data you specified will now load: you can see
a protected_areas item in the Layers panel (bottom left) with its features shown in the
main map canvas.
6
Congratulations! You now have a basic map. Now would be a good time to save your work.
Here we focus on the first method, interactive measurement tools . Click the icon in the
Attribute toolbar to begin measurements. The down arrow near the icon switches
between length, area, bearing or angle. The default unit used in the dialog is the
one set in Project ► Properties… ► General menu.
For the Measure Line and the Measure Area the measurements can be done
Measure Line
The measures distances between given points. The tool then allows you to click
points on the map. Each segment length, as well as the total, shows up in the measure window. In
the measure window, you will see coordinates for all your points and distances. Keep in mind that
the first row will contain only coordinates, as it represents your starting point. To stop measuring,
click the right mouse button.
Note that you can use the drop-down list near the
total to change the measurement units interactively
while working with the measure tool. This unit is
retained for the widget until a new project is created
or another project is opened.
The Info section in the dialog explains how
calculations are made according to the Coordinate
Reference System (CRS) settings available
7
Measure Area
: Areas can also be measured. In the measure window, the accumulated area size
appears. Right-click to stop drawing. The Info section is also available as well as the ability to
switch between different area units.
Measure Bearing
: You can also measure bearings. The cursor becomes cross-shaped. Click to draw
the first point of the bearing, then move the cursor to draw the second point. The measurement is
displayed in a pop-up dialog.
8
Measure Angle
: You can also measure angles. The cursor becomes cross-shaped. Click to draw the
first segment of the angle you wish to measure, then move the cursor to draw the desired angle.
The measurement is displayed in a pop-up dialog.
A roads layer is added to the Layers panel with features displayed on the map canvas.
3. Click on Close.
Congratulations! You have loaded the first layer from a GeoPackage.
Loading vector data from a SpatiaLite Database with the Browser
QGIS provides access to many other database formats. Like GeoPackage, the SpatiaLite database
format is an extension of the SQLite library. And adding a layer from a SpatiaLite provider follows
the same rules as described above: Create the connection –> Enable it –> Add the layer(s).
While this is one way to add SpatiaLite data to your map, let’s explore another powerful way to
add data: the Browser.
10
For example, click on the drop-down icon next to the GeoPackage entry. You’ll see
the training-data.gpkg file we previously connected to (and its layers, if expanded).
Notice that a landuse.sqlite entry has been added under the SpatiaLite one.
Tip: Enable the Browser panel in View ► Panels ► and use it to add your data. It’s a handy
shortcut for the Data Source Manager ► Browser tab, with the same functionality.
Note: Remember to save your project frequently! The project file doesn’t contain any of the data
itself, but it remembers which layers you loaded into your map.
Task 3
Load the following datasets from the practical_data folder into your map using any of the methods
explained above:
• buildings
• water
Reordering the Layers
The layers in your Layers list are drawn on the map in a certain order. The layer at the bottom of
the list is drawn first, and the layer at the top is drawn last. By changing the order that they are
shown on the list, you can change the order they are drawn in.
Note: You can alter this behavior using the Control rendering order checkbox beneath
the Layer Order panel. We will however not discuss this feature yet.
11
The order in which the layers have been loaded into the map is probably not logical at this stage.
It’s possible that the road layer is completely hidden because other layers are on top of it.
For example, this layer order would result in roads and places being hidden as they
run underneath the polygons of the landuse layer.
You’ll see that the map now makes more sense visually, with roads and buildings appearing above
the land use regions.
12
Now you’ve added all the layers you need from several different sources and created a basic map!
Now you’re familiar with the basic function of the Open Data Source Manager button, but what
about all the others? How does this interface work? Before we go on, let’s take a look at some
basic interaction with the QGIS interface. This is the topic of the next section.
1.3. Navigating the Map Canvas
This section will focus on basic QGIS navigation tools used to navigate within the Map Canvas.
These tools will allow you to visually explore the layers at different scales.
The goal for this section: Learn how to use Pan and Zoom tools within QGIS and learn about
map scale.
Basic Navigation Tools
Before learning how to navigate within the Map Canvas, let’s add some layers that we can explore
during this tutorial.
1. Open a new blank project and using the steps learnt in Prepare a Map, load the previously
seen protected_areas, roads and buildings layers to the project. The result view should look
similar to the snippet below (colors do not matter):
Pan
1. In the Map Navigation Toolbar, make sure the button is activated.
2. Move the mouse to the center of the Map Canvas area.
3. Left-click and hold, and drag the mouse in any direction to pan the map.
Next, let’s zoom in and take a closer look at the layers we imported.
13
Zoom In
1. In the Map Navigation Toolbar, click on the button.
2. Move your mouse to approximately the top left area of where there is the highest density
of buildings and roads.
3. Left click and hold.
4. Then drag the mouse, which will create a rectangle, and cover the dense area of buildings
and roads.
5. Release the left click. This will zoom in to include the area that you selected with your
rectangle.
Zoom Out
6. To zoom out, select the button and perform the same action as you did for
zooming in.
14
As you pan, zoom in, or zoom out, QGIS saves these views in a history. This allows you to
backtrack to a previous view.
Zoom Last
1. In the Map Navigation Toolbar, click on button to go to your previous view.
Zoom Next
2. Click on button to proceed to move forward in your history.
Sometimes after exploring the data, we need to reset our view to the extent of all the layers. Instead
of trying to use the Zoom Out tool multiple times, QGIS provides us with a button to do that action
for us.
You can also use this field to set the Map Scale manually.
1. In the Status Bar, click on the Scale textfield.
2. Type in 50000 and press Enter. This will redraw the features in the Map Canvas to reflect
the scale you typed in.
3. Alternatively, click on the options arrow of the Scale field to see the preset map scales.
4. Select 1:5000. This will also update the map scale in the Map Canvas.
Now you know the basics of navigating the Map Canvas. Check out the User Manual on Zooming
and Panning to learn about alternative ways of navigating the Map Canvas.
Knowing how to navigate the Map Canvas is important, as it allows one to explore and visually
inspect the layers. This could be done for initial data exploration, or to validate output of a spatial
analysis.
15
PRACTICAL 2: Symbology
The symbology of a layer is its visual appearance on the map. The basic strength of GIS over
other ways of representing data with spatial aspects is that with GIS, you have a dynamic visual
representation of the data you’re working with. Therefore, the visual appearance of the map
(which depends on the symbology of the individual layers) is very important. The end user of
the maps you produce will need to be able to easily see what the map represents. Equally as
important, you need to be able to explore the data as you’re working with it, and good
symbology helps a lot. In other words, having proper symbology is not a luxury or just nice to
have. In fact, it’s essential for you to use a GIS properly and produce maps and information
that people will be able to use.
Changing Colors
To change a layer’s symbology, open its Layer Properties. Let’s begin by changing the color of
the landuse layer.
1. Right-click on the landuse layer in the layers list.
2. Select the menu item Properties… in the menu that appears.
Note: By default, you can also access a layer’s properties by double-clicking on the layer in the
Layers list.
Tip: The button at the top of the Layers panel will open the Layer Styling panel. You can
use this panel to change some properties of the layer: by default, changes will be applied
immediately!
4. Click the color select button next to the Color label. A standard color dialog will appear.
16
5. Choose a gray color and click OK.
6. Click OK again in the Layer Properties window, and you will see the color change being
applied to the layer.
Task 1
Change the color of the water layer to light blue. Try to use the Layer Styling panel instead of
the Layer Properties menu.
Changing Symbol Structure
This is good stuff so far, but there’s more to a layer’s symbology than just its color. Next we want
to eliminate the lines between the different land use areas so as to make the map less visually
cluttered.
1. Open the Layer Properties window for the landuse layer.
Under the Symbology tab, you will see the same kind of dialog as before. This time,
however, you’re doing more than just quickly changing the color.
2. In the symbol layers tree, expand the Fill dropdown and select the Simple fill option.
3. Click on the Stroke style dropdown. At the moment, it should be showing a short line and
the words Solid Line.
4. Change this to No Line.
1. Click OK.
Now the landuse layer won’t have any lines between areas.
17
Task 2
• Change the water layer’s symbology again so that it has a darker blue outline.
• Change the rivers layer’s symbology to a sensible representation of waterways.
18
4. Change the Minimum value to 1:10000.
5. Click OK.
Test the effects of this by zooming in and out in your map, noting when the buildings layer
disappears and reappears.
Note: You can use your mouse wheel to zoom in increments. Alternatively, use the zoom tools
to zoom to a window:
19
In this example, the current symbol has no outline (i.e., it uses the No Line border style).
It may appear somewhat different in color, for example, but you’re going to change that anyway.
20
Now there’s a second symbol layer. Being a solid color, it will of course completely hide the
previous kind of symbol. Plus, it has a Solid Line border style, which we don’t want. Clearly this
symbol has to be changed.
Note: It’s important not to get confused between a map layer and a symbol layer. A map layer is
a vector (or raster) that has been loaded into the map. A symbol layer is part of the symbol used to
represent a map layer. This course will usually refer to a map layer as just a layer, but a symbol
layer will always be called a symbol layer, to prevent confusion.
With the new Simple Fill symbol layer selected:
1. Set the border style to No Pen, as before.
2. Change the fill style to something other than Solid or No brush. For example:
3. Click OK.
Now you can see your results and tweak them as needed. You can even add multiple extra symbol
layers and create a kind of texture for your layer that way.
It’s fun! But it probably has too many colors to use in a real map…
21
Task 3
Remembering to zoom in if necessary, create a simple, but not distracting texture for
the buildings layer using the methods above.
22
Well, roads have now a street like symbology, but you see that lines are overlapping each others
at each cross. That’s not what we want at all!
To prevent this from happening, you can sort the symbol levels and thereby control the order in
which the different symbol layers are rendered.
To change the order of the symbol layers:
1. Select the topmost Line layer in the symbol layers tree.
2. Click Advanced ► Symbol levels… in the bottom right-hand corner of the window.
23
3. Check Enable symbol levels. You can then set the layer order of each symbol by
entering the corresponding level number. 0 is the bottom layer.
In our case, we just want to activate the option, like this:
4. This will render the white line above the thick black line borders:
5. Click OK twice to return to the map.
The map will now look like this:
24
When you’re done, remember to save the symbol itself so as not to lose your work if you change
the symbol again in the future. You can save your current symbol style by clicking the Save
Style… button at the bottom of the Layer Properties dialog. We will be using the QGIS QML
Style File format.
Save your style in the practical_data/styles/better_roads.qml folder. You can load a previously
saved style at any time by clicking the Load Style… button. Before you change a style, keep in
mind that any unsaved style you are replacing will be lost.
Task 4
Change the appearance of the roads layer again.
Make the roads narrow and yellow, with a thin, pale gray outline and a thin black line in the middle.
Remember that you may need to change the layer rendering order via the Advanced ► Symbol
levels… dialog.
Symbol levels also work for classified layers (i.e., layers having multiple symbols). Since we
haven’t covered classification yet, you will work with some rudimentary pre-classified data.
1. Create a new project and add only the roads dataset.
2. Apply the style file advanced_levels_demo.qml provided in practical_data/styles to the
layer. This can be done through the Style ► Load Style… combobox at the bottom of
the Layer Properties dialog.
3. Zoom in to the road intersection part.
4. Using symbol layers, ensure that the outlines of layers flow into one another as per the
image below:
25
Symbol layer types
In addition to setting fill colors and using predefined patterns, you can use different symbol layer
types entirely. The only type we’ve been using up to now was the Simple Fill type. The more
advanced symbol layer types allow you to customize your symbols even further.
Each type of vector (point, line and polygon) has its own set of symbol layer types. First we will
look at the types available for points.
Point Symbol Layer Types
1. Open your original map again (called basic_map).
2. Uncheck all the layers except for places.
3. Change the symbol properties for the places layer:
26
4. You can access the various symbol layer types by selecting the Simple marker layer in
the symbol layers tree, then click the Symbol layer type dropdown:
5. Investigate the various options available to you, and choose a symbol with styling you think
is appropriate.
6. If in doubt, use a round Simple marker with a white border and pale green fill, with
a Size of 3.00 and a Stroke width of 0.5.
27
Line Symbol Layer Types
To see the various options available for line data:
1. Change the Symbol layer type for the roads layer’s topmost symbol layer to Marker
line:
2. Select the Simple marker layer in the symbol layers tree. Change the symbol properties
to match this dialog:
28
3. Select the Marker line layer and change the interval to 1.00:
4. Ensure that the symbol levels are correct (via the Advanced ► Symbol levels dialog we
used earlier) before applying the style.
Once you have applied the style, take a look at its results on the map. As you can see, these
symbols change direction along with the road but don’t always bend along with it. This is useful
for some purposes, but not for others. If you prefer, you can change the symbol layer in question
back to the way it was before.
Polygon Symbol Layer Types
To see the various options available for
polygon data:
1. Change the Symbol layer type for
the water layer, as before for the
other layers.
2. Investigate what the different
options on the list can do.
3. Choose one of them that you find
suitable.
4. If in doubt, use the Point pattern
fill with the following options:
29
Add a new symbol layer with a
normal Simple fill.
5. Make it the same light blue
with a darker blue border.
6. Move it underneath the point
pattern symbol layer with
the Move down button:
As a result, you have a textured symbol for the water layer, with the added benefit that you can
change the size, shape and distance of the individual dots that make up the texture.
30
Task 5
Apply a green transparent fill color to the protected_areas layer, and change the outline to look
like this:
31
3. Before to start writing the spatial query we have to choose the Geometry Type in output.
In this example we are going to create centroids for each feature, so change the Geometry
Type to Point / Multipoint.
4. Now let’s write the
query in the query panel:
centroid($geometry)
When you click on OK you will see that the water layer is rendered as a point layer! We have just
run a spatial operation within the layer symbology itself, isn’t that amazing?
32
With the Geometry generator symbology you can really go over the edge of normal symbology.
Task 6
Geometry generator are just another symbol level. Try to add another Simple fill underneath
the Geometry generator one.
Change also the appearance of the Simple marker of the Geometry generator symbology.
The final result should look like this:
33
PRACTICAL 3: Vector Data
Classifying vector data allows you to assign different symbols to features (different objects in
the same layer), depending on their attributes. This allows someone who uses the map to easily
see the attributes of various features. The following topics are covered:
3.1. Vector Attribute Data
3.2. Labels
3.3. Classification
34
A row is called a record and is associated with a feature in the Canvas Map, such as a polygon.
A column is called a field (or an attribute), and has a name that helps describe it, such
as name or id. Values in the cells are known as attribute values. These definitions are commonly
used in GIS, so it is good to become familiar with them.
In the protected_areas layer, there is one feature, which is represented by the polygon we see on
the Map Canvas.
Note: In order to understand what the fields and attribute values represent, one may need to find
documentation (or metadata) describing the meaning of the attribute values. This is usually
available from the creator of the data set.
Next, let’s see how a record in the attribute table is linked to a polygon feature that we see on the
Map Canvas.
1. Go back to the main QGIS window.
Select Feature
2. In the Attributes Toolbar, click on the button.
3. Make sure the protected_areas layer is still selected in the Layers panel.
4. Move your mouse to the Map Canvas and left click on the smaller of the two polygons.
The polygon will turn yellow indicating it is selected.
35
5. Go back to the Attribute Table window, and you should see a record (row) highlighted.
These are the attribute values of the selected polygon.
Sometimes there are many features shown on the Map Canvas and it might be difficult to see which
feature is selected from the Attribute Table. Another way to identify the location of a feature is to
use the Flash Feature tool.
1. In the Attribute Table, right-click on any cell in the row that has the attribute
value v455098741 for the field full_id.
2. In the context menu, click on Flash Feature and watch the Map Canvas.
36
You should see the polygon flash red a few times. If you missed it, try it again.
Another useful tool is the Zoom to Feature tool, that tells QGIS to zoom to the feature of interest.
1. In the Attribute Table, right-click on any cell in the row that has the attribute
value r2855697 for the field full_id.
2. In the context menu, click on Zoom to Feature
Look at the Map Canvas. The polygon should now occupy the extent of the Map Canvas area.
You may now close the attribute table.
3.2. Labels
Labels can be added to a map to show any information about an object. Any vector layer can have
labels associated with it. These labels rely on the attribute data of a layer for their content.
Using Labels
First, ensure that the button is visible in the GUI:
1. Go to the menu item View ► Toolbars
2. Ensure that the Label Toolbar item has a check mark next to it. If it doesn’t, click on
the Label Toolbar item to activate it.
3. Click on the places layer in the Layers panel so that it is highlighted
4. Click on the toolbar button to open the Labels tab of the Layer Styling panel
5. Switch from No Labels to Single Labels
37
You’ll need to choose which field in the attributes will be
used for the labels. In the previous lesson, you decided that
the name field was the most suitable one for this purpose.
6. Select name from the Value list:
7. Click Apply
38
Note: Above, you used the button in the Label Toolbar to open the Layer Styling panel. As
with Symbology, the same label options are available via both the Layer Styling panel and
the Layer Properties dialog. Here, you’ll use the Layer Properties dialog.
1. Open the Layer Properties dialog by double-clicking on the places layer
2. Select the Labels tab
3. Make sure Text is selected in the left-hand options list, then update the text formatting
options to match those shown here:
4. Click Apply
That font may be larger and more familiar to users, but its readability is still dependent on what
layers are rendered beneath it. To solve this, let’s take a look at the Buffer option.
39
5. Select Buffer from the left-hand options list
6. Select the checkbox next to Draw text buffer, then choose options to match those shown
here:
7. Click Apply
You’ll see that this adds a colored buffer or border to the place labels, making them easier to pick
out on the map:
40
Now we can address the positioning of the labels in relation to their point markers.
8. Select Placement from the left-hand options list
9. Select Around point and change the value of Distance to 2.0 Millimeters:
41
2. Select the Placement option from the options list
3. Click on the Offset from point button
This will reveal the Quadrant options which you can use to set the position of the label in relation
to the point marker. In this case, we want the label to be centered on the point, so choose the center
quadrant:
4. Hide the point symbols by editing the layer Symbology as usual, and setting the size of
the Marker size to 0.0:
42
5. Click Apply and you’ll see this result:
If you were to zoom out on the map, you would see that some of the labels disappear at larger
scales to avoid overlapping. Sometimes this is what you want when dealing with datasets that have
many points, but at other times you will lose useful information this way. There is another
possibility for handling cases like this, which we’ll cover in a later exercise in this lesson. For now,
zoom out and click on the button in the toolbar and see what happens.
Task 1
• Reset the label and symbol settings to have a point marker and a label offset
of 2.0 Millimeters.
• Reset the label and symbol settings to have a point marker and a label offset of 2.0
Millimeters.
43
Labeling Lines
Now that you know how labeling works, there’s an additional problem. Points and polygons are
easy to label, but what about lines? If you label them the same way as the points, your results
would look like this:
44
You’ll probably find that the text styling has used default values and the labels are consequently
very hard to read. Update the Text to use a dark-grey or black Color and the Buffer to use a light-
yellow Color.
The map will look somewhat like this, depending on scale:
You’ll see that some of the road names appear more than once and that’s not always
necessary. To prevent this from happening:
45
1. Click OK
Another useful function is to prevent labels being drawn for features too short to be of notice.
2. In the same Rendering panel, set the value of Suppress labeling of features smaller than
… to 5.00 mm and note the results when you click Apply
Try out different Placement settings as well. As we’ve seen before, the Horizontal option is not
a good idea in this case, so let’s try the Curved option instead.
3. Select the Curved option in the Placement panel of the Labels tab
Here’s the result:
46
3.3. Classification
Labels are a good way to communicate information such as the names of individual places, but
they can’t be used for everything. For example, let us say that someone wants to know what
each landuse area is used for. Using labels, you would get this:
This makes the map’s labeling difficult to read and even overwhelming if there are numerous
different landuse areas on the map.
Classifying Nominal Data
1. Open the Layer Properties dialog for the landuse layer
2. Go to the Symbology tab
3. Click on the dropdown that says Single Symbol and change it to Categorized:
47
4. In the new panel, change the Value to landuse and the Color ramp to Random colors
5. Click the button labeled Classify.
6. Click OK
You’ll see something like this:
48
7. Click the arrow (or plus sign) next to landuse in the Layers panel, you’ll see the categories
explained:
Now our landuse polygons are colored and are classified so that areas with the same land use are
the same color.
8. If you wish to, you can change the symbol of each landuse area by double-clicking the
relevant color block in the Layers panel or in the Layer Properties dialog:
49
Notice that there is one category that’s empty:
This empty category is used to color any objects which do not have a landuse value defined or
which have a NULL value. It can be useful to keep this empty category so that areas with
a NULL value are still represented on the map. You may like to change the color to more obviously
represent a blank or NULL value.
Remember to save your map now so that you don’t lose all your hard-earned changes!
Task 2
Use the knowledge you gained above to classify the buildings layer. Set the categorisation against
the building field and use the Spectral color ramp.
Note: Remember to zoom into an urban area to see the results.
Automatic selection
The other selection tools, most of them available from the Attribute table, perform a selection
based on a feature’s attribute or its selection state (note that attribute table and map canvas show
the same information, so if you select one feature in the attribute table, it will be selected on the
map canvas too):
Select By Expression…
• select features using expression dialog
50
Deselect Features from All Layers
• or press Ctrl+Alt+A to deselect all selected features in all
layers
Select by Location
• to select the features based on their spatial relationship with other features
6. "place" = 'suburb'
7. Click Select Features. How many features are selected?
From the expression builder dialog, you can also use Function list ► Recent (Selection) to make
a selection that you have used before. The dialog remembers the last 20 expressions used.
51
PRACTICAL 4: Laying Out the Maps
Now that you’ve got a map, you need to be able to print it or to export it to a document. The
reason is, a GIS map file is not an image. Rather, it saves the state of the GIS program, with
references to all the layers, their labels,colors, etc. So for someone who doesn’t have the data
or the same GIS program (such as QGIS), the map file will be useless. Luckily, QGIS can
export its map file to a format that anyone’s computer can read, as well as printing out the map
if you have a printer connected. Both exporting and printing is handled via the Print Layout.
Under New from Template, select Empty layout and press the Create… button.
2. Give the new layout the name of Swellendam and click OK.
3. You will now see the Print Layout window:
You could also create this new layout via the Project ► New Print Layout… menu.
52
Whichever route you take, the new print layout is now accessible from the Project ► Layouts
► menu, as in the image below.
Add Map
3. Click on the button.
With this tool activated, you will be able to place a map on the page.
53
4. Click and drag a box on the blank page:
54
Note: Your map may look a lot different, of course! This depends on how your own project is set
up. But not to worry! These instructions are general, so they will work the same regardless of what
the map itself looks like.
7. Be sure to leave margins along the edges, and a space along the top for the title.
8. Zoom in and out on the page (but not the map!) by using these buttons:
9. Zoom and pan the map in the main QGIS window. You can also pan the map using
Move item content
the tool.
The map view updates as you zoom in or zoom out.
10. If, for any reason, the map view does not refresh correctly, you can force the map to refresh
Refresh view
by clicking the button.
Remember that the size and position you’ve given the map doesn’t need to be final. You can always
come back and change it later if you’re not satisfied. For now, you need to ensure that you’ve
saved your work on this map. Because a Print Layout in QGIS is part of the main map file, you
must save your project.
11. Go to the Layout ► Save Project. This is a convenient shortcut to the one in the main
dialog.
55
Adding a Title
Now your map is looking good on the page, but your readers/users are not being told what’s going
on yet. They need some context, which is what you’ll provide for them by adding map elements.
First, let us add a title.
Add Label
1. Click on the button
2. Click on the page, above the map, accept the suggested values in the New Item
Properties dialog, and a label will appear at the top of the map.
3. Resize it and place it in the top center of the page. It can be resized and moved in the same
way that you resized and moved the map.
As you move the title, you’ll notice that guidelines appear to help you position the title in the center
of the page.
However, there is also a tool in the Actions Toolbar to help position the title relative to the map
(not the page):
Now the label frame is centered on the map, but not the contents. To center the contents of the
label:
1. Select the label by clicking on it.
2. Click on the Item Properties tab in the side panel of the layout window.
3. Change the text of the label to “Richards Bay”:
56
4. Use this interface to set the font and alignment
options under the Appearance section:
1. Choose a large but sensible font (the example
will use the default font with a size of 36)
2. Set the Horizontal Alignment to Center.
You can also change the font color, but it’s probably best to
keep it black as per the default.
2. The default setting is not to add a frame to the title’s
text box. However, if you wish to add a frame, you
can do so:
1. In the Item Properties tab, scroll down until
you see the Frame option.
2. Click the Frame checkbox to enable the
frame. You can also change the frame’s color
and width.
In this example, we won’t enable the frame, so here is our page so far:
57
To make sure that you don’t accidentally move these elements around now that you’ve aligned
them, you can lock items into place:
1. Select both the label and the map items
Lock Selected Items
2. Click the button in the Actions Toolbar.
Unlock All Items
Note: Click the button in the Actions Toolbar to be able to edit the items again.
Adding a Legend
he map reader also needs to be able to see what various things on the map actually mean. In some
cases, like the place names, this is quite obvious. In other cases, it’s more difficult to guess, like
the colors of the forests. Let’s add a new legend.
Add Legend
1. Click on the button
2. Click on the page to place the legend, accept the suggested values in the New Item
Properties dialog,
3. A legend is added to the layout page, showing layers symbology as set in the main dialog.
4. As usual, you can click and move the item to where you want it:
58
2. Uncheck the Auto update box, allowing you to directly modify the legend items
3. Select the entry with buildings
4. Delete it from the legend by clicking the button
You can also rename items.
1. Select a layer from the same list.
Edit selected item properties
2. Click the button.
3. Rename the layers to Places, Roads and Streets, Surface Water, and Rivers.
You can also reorder the items:
As the legend will likely be widened by the new layer names, you may wish to move and resize
the legend and or map. The map does not fully reflect Richards Bay as the western section is
Empangeni. You may want to zoom in more on the eastern part of the map to show Richards Bay
places. This is the result:
59
Task 1
Add other essential map elements such as:
1. North arrow
2. Scale bar
3. Neat line/frame
Optionally, you can also add a background image such the open street map.
Exporting Your Map
Note: Did you remember to save your work often?
Finally the map is ready for export! You’ll see the export buttons near the top left corner of the
layout window:
Print Layout
• : interfaces with a printer. Since the printer options will differ depending on
the model of printer that you’re working with, it’s probably better to consult the printer
manual or a general guide to printing for more information on this topic.
The other buttons allow you to export the map page to a file.
Export as Image
• : gives you a selection of various common image formats to choose from.
This is probably the simplest option, but the image it creates is “dead” and difficult to edit.
60
Export as SVG
• : If you’re sending the map to a cartographer (who may want to edit the map
for publication), it’s best to export as an SVG. SVG stands for “Scalable Vector Graphic”,
and can be imported to programs like Inkscape or other vector image editing software.
Export as PDF
• : If you need to send the map to a client, it’s most common to use a PDF,
because it’s easier to set up printing options for a PDF. Some cartographers may prefer
PDF as well, if they have a program that allows them to import and edit this format.
For our purposes, we’re going to use PDF.
Export as PDF
1. Click the button
2. Choose a save location and a file name as usual. The following dialog will show up.
3. You can safely use the default values now and click Save.
QGIS will proceed to the map export and push a message on top of the print layout dialog as soon
as it finishes.
4. Click the hyperlink in the message to open the folder in which the PDF has been saved in
your system’s file manager
5. Open it and see how your layout looks.
Everything is OK? Congratulations on your first completed QGIS map project!
6. Anything unsatisfying? Go back to the QGIS window, do the appropriate modifications
and export again.
7. Remember to save your project file.
61
EXERCISE
Please answer the following questions and submit your answers.
Instructions:
• Select the ellipsoidal option to measure distances and areas.
• Round-off your answers to the whole number.
1.What is the distance in kilometers between Empangeni and Richards Bay? [2 marks]
2.What is the name of the area closest to Lake Qhubu? [2 marks]
3. What is the total surface area (in hectares) of the Grantham Dam? [2 marks]
4. How many fields are available in the rivers layer? [2 marks]
5. In which direction does the uMhlathuze River flow? [1 mark]
6. Provide some information about the towns and cities included in your dataset. How many
towns and cities are there, and what are their respective names? [4 marks]
7. Open the attribute table for the places layer. Which field would be the most useful to represent
in label form, and why? [2 marks]
8. How many records does the places layer have? [2 marks]
9. Open the attribute table for the roads layer. How many features are classified as secondary
roads? [3 marks]
10. How many features are classified as residential roads? [3 marks]
11. What is the true bearing from Felixton to Alton? [2 marks]
12. What is the true bearing from Arboretum to KwaDlangezwa? [2 marks]
13. Open the attribute table for the landuse layer. What is the number of features classified as
industrial? [3 marks]
TOTAL: 30 marks
62
CREDITS
The contents of this practical manual have been adapted from the QGIS Training Manual, which
is accessible at https://docs.qgis.org/3.28/en/docs/training_manual/index.html.
63