QGIS Fundamentals Course Samoa 0
QGIS Fundamentals Course Samoa 0
QGIS Fundamentals Course Samoa 0
1
Table of Contents
What is QGIS and where do I get it? ............................................................................................................4
Introduction to GIS....................................................................................................................................4
Quick Glossary...........................................................................................................................................5
Exercise 1 – Familiarisation with QGIS ........................................................................................................8
QGIS Work Space ......................................................................................................................................8
Exercise 2 – Adding Data ........................................................................................................................... 12
Adding Vector Datasets in QGIS ........................................................................................................... 13
Adding Raster Data in QGIS .................................................................................................................. 17
Saving and Opening QGIS Projects......................................................................................................... 19
Exercise 3 – Changing the Display of Layers ............................................................................................. 20
Labelling Features .................................................................................................................................. 21
Simple Symbology (Polygon) .................................................................................................................. 25
Point Symbology .................................................................................................................................... 29
Line Symbology ...................................................................................................................................... 31
Exercise 4 – Creating Maps ....................................................................................................................... 33
Prepare Your Map .................................................................................................................................. 33
Print Composer ...................................................................................................................................... 34
Add Map................................................................................................................................................. 36
Add Title ................................................................................................................................................. 37
Add Legend ............................................................................................................................................ 39
Add Scale bar ......................................................................................................................................... 40
Add Image (Logos, North Arrow) ........................................................................................................... 40
Finalising and Exporting the Map .......................................................................................................... 42
Exercise 5 – Navigating in QGIS ................................................................................................................ 43
Using Table of Contents ......................................................................................................................... 43
Navigating the Map................................................................................................................................ 44
Exercise 6 – Attribute Tables .................................................................................................................... 46
Identify Features on the Map ................................................................................................................ 46
Open Attribute Table ............................................................................................................................. 47
Symbolizing by Attributes ...................................................................................................................... 49
Selecting Features (optional extra) ........................................................................................................ 52
Exercise 7 – Creating Shapefiles................................................................................................................ 56
Create New Shapefiles ........................................................................................................................... 56
Creating New Line and Polygon Shapefile Layers (optional extra) ........................................................ 60
Exercise 8 – Creating and Editing Points and Polygons ............................................................................ 62
2
Editing Toolbar ....................................................................................................................................... 62
Creating and Editing Points .................................................................................................................... 63
Creating and Editing Polygons ............................................................................................................... 65
Exercise 9 – Importing GPS Data into QGIS .............................................................................................. 67
Delimited Text Layers............................................................................................................................. 67
GPX files from Garmin GPS Units ........................................................................................................... 69
Additional Resources ................................................................................................................................ 71
Free online guides: ................................................................................................................................. 71
3
What is QGIS and where do I get it?
QGIS is an open source GIS (Geographic Information System) software – which means it's FREE for
download and use for all your mapping and GIS needs.
The software is constantly developing and being improved upon. These training materials are based on
the latest stable release that was available at the time: QGIS 3.4. To download the latest version of QGIS
visit the official QGIS website, http://www.qgis.org/
Introduction to GIS
What is a GIS?
A Geographic Information System a software for viewing data with a spatial reference for real-world
viewing, mapping and analysis.
The primary segment of the data seen in a GIS is its spatial component – i.e. where is it on earth?
Each piece of data will also contain non-spatial data known as attribute data. Attribute data is generally
defined as additional information about a spatial feature, for example, a government building. The
actual location of the government building is the spatial data. The attribute data includes the building
name, the number of floors in the building, the government departments that use the building, when it
was built etc.
GIS is now commonly used in many aspects of our day-to-day lives. For example, Google Maps on our
phones to find an address is a type of GIS.
4
Quick Glossary
Layers
Layers are the mechanism used to display spatial datasets in QGIS. Each layer relates to a specific
dataset and specifies how that dataset is displayed using symbols and text labels. Each map created in
QGIS is assembled by adding a series of layers. The two most commonly used types of layer are vector
(feature) layers and raster layers.
Layer 1
Layer 2
Layer 5 etc
A Vector layer
A representation of the world using points, lines, and polygons. Vector layers are useful for
storing data that has discrete boundaries, such as country borders, land parcels, and streets.
5
A Raster layer
A spatial data layer that is in the form of an image with pixels. The image is made up of equally
sized pixels (or cells) arranged in rows and columns. Each pixel contains an attribute value and
location coordinates. Groups of cells that share the same value represent the same type of
geographic feature. See two examples below:
Attribute
Information about a spatial feature. For example, attributes about a school may include the name, level
of education, and number of students.
Coordinate system
A coordinate system is a reference system used to represent the locations of geographic features,
imagery, and observations such as GPS locations within a common geographic framework.
Scale
A level of resolution or zoom. The relationship between the size of the map and the corresponding size
of the real world.
Shapefile (*.shp)
A type of vector data storage format for storing the location, shape, and attributes of geographic
features. Each shapefile relates to a specific feature class i.e. the Roads shapefile only contains
information on roads
Symbology
Conventions or rules that define how geographic features are represented by symbols on a map.
6
Query
In GIS, a request to select features or records from an attributes table based on user-selected criteria,
and to display only those features or records that meet the criteria.
7
Exercise 1 – Familiarisation with QGIS
When opening QGIS for the first time you will see the screen below:
The first step you will do is right click on the blank grey space near the top of the screen. This will open
a dialog box that lets the user add panels and toolbars to the user interface.
You will click and add two objects here: The Processing Toolbox Panel and the Manage Layers Toolbar.
8
Your QGIS should now look like this:
• Menu Options
• Toolbar
• Map Canvas
• Browser
• Table of Contents
• Tool Box
• Status Bar
Menu Options
The Menu Options bar provides access to various QGIS features using a standard hierarchical
menu (drop down menu). Most menu options have a corresponding tool in the Toolbar and
Tool Box, however the menus are not organised exactly like the toolbars and may contain
additional tools.
Toolbar
The Toolbar provides access to most of the functions found in the menu options bar, plus additional
tools for interacting with the map canvas. Each Toolbar item has pop-up help available. Hold your
mouse over an item and a short description of the tool’s purpose will be displayed.
Below is the Managing Layers Toolbar that you added at the beginning of this exercise.
9
The Managing Layers Toolbar contains frequently used tools relating to GIS layers. The two symbols
circled in red represent the ‘add vector layer’ tool and the ‘add raster layer’ tool, which will be most
commonly used to bring data into the QGIS document.
Parts of the Toolbar can be moved around according to your needs. Additionally, parts of the Toolbar
can be switched on/off. Hold the mouse over a blank spot on the Toolbar and click the right mouse
button to see the context menu, which allows you to turn on/off tools.
If you have accidentally hidden all your Toolbars, you can get them back by choosing Menu Options –
View – Toolbars
Map Canvas
The Map Canvas is the main part of QGIS – this is where the maps are displayed. The map displayed in
the window will depend on the vector and raster layers you have chosen to load (see sections that
follow for more information on how to load layers). The Map Canvas can be panned, shifting the focus
of the display to another part of the map. The map can also be zoomed in and out. Various other
operations can be performed on the map using the Toolbar. The Map Canvas and the Table of Contents
are tightly bound to each other — the maps in Map Canvas reflect changes you make in the Table of
Contents area.
You can use the mouse wheel to zoom in and out on the map. Place the mouse cursor inside the map
area and roll the wheel forward (away from you) to zoom in and backwards (towards you) to zoom out.
The zoom is centred on the mouse cursor position.
Table of Contents
The Table of Contents area lists all the layers in your map project. Click on a check box to turn a layer on
or off. Double click on a layer in the legend to customise its appearance and set other properties (e.g.
appearance of symbols, labels). A layer can be selected and dragged up or down in the Table of
Contents to change the Z-ordering. Z-ordering means that layers listed nearer the top of the Table of
Contents are drawn over layers listed lower down in the Table of Contents.
Tool Box
10
The Processing Toolbox which contains geoprocessing tools used for creation and analysis of both
vector and raster data. As mentioned before, some of these tools will also be available in the Menu
Options as well.
Status Bar
The Status Bar shows you the current position of the mouse pointer in map coordinates (expressed as
decimal degrees or meters) as well as the map scale and coordinate system. As the mouse pointer is
moved across the map view, the coordinates will change. As you zoom in and out of the map, the scale
will change.
11
Exercise 2 – Adding Data
This exercise will familiarise you with QGIS and allow you to examine the different data types available
and how to add them to the map.
By completing this exercise, you will learn how to perform the following tasks:
(In the folder you will find more datasets, but for now we will use the above)
C:\QGIS_Training_Samoa\03_Workspace
12
Adding Vector Datasets in QGIS
Vector data is arguably the most common kind of GIS data. It describes geographic data in terms of
points, which may be connected into lines and polygons. Every object in a vector dataset is called a
feature, and is associated with data that describes that feature.
QGIS can support a number of different vector data formats. These include ESRI Shapefiles and MapInfo
TAB files, all of which can be used in QGIS in their current formats. We will mostly be using ESRI
Shapefiles.
• Click on All files (*) and filter the displayed files by selecting ESRI Shapefiles from the drop down
menu
13
• Select Samoa_coastline.shp and click Open
14
If you have successfully added a vector layer you should see the layer in the Table of Contents and an
image on the Map Canvas
• Repeat the process to add the following vector layer to the map:
C:\QGIS_Training_Samoa\02_Datasets\Samoa_roads_2016_OSM.shp
15
Zoom to Upolu and the result should look something like this:
• And once more, repeat the process to add the following vector layer to the map:
C:\QGIS_Training_Samoa\02_Datasets\Samoa_village_names.shp
16
Adding Raster Data in QGIS
Raster data is quite different from vector data. Vector data (point, line and polygons) are features that
are constructed out of mathematical vector points (a line is a connection of two points, a polygon is a
connection of many vector points). Raster data, however, is like an image. Although it may portray
various properties of objects in the real world, these objects don’t exist as separate objects; rather, they
are represented using pixels of various different colour values.
• Locate and press the Add Raster Layer button (under the Add Vector button)
As the raster file is quite large it may take a little time for it to be displayed on the Map Canvas
17
Satellite Image now added
Click on the image
and drag the file
Samoa_coastline
underneath
Click on the raster file and drag it underneath the Samoa_coastline.shp. You have now placed the raster
image as the last layer in the Map Canvas
18
Saving and Opening QGIS Projects
Once we have some vector and raster layers loaded into our map we need to save it!! Saving our project
so that we can come back to it later if we need to.
• Navigate to C:\QGIS_Training_Samoa\03_Workspace
• Save the project as 2020_Samoa_QGIS_Training1
Make sure that your project loads successfully, we will use it for the next exercise.
19
Exercise 3 – Changing the Display of Layers
The following exercise will teach you how to label and modify the display of the layers in the map.
By completing this exercise, you will learn how to perform the following tasks:
• Adding labels
• Apply simple symbology to vector layers
• Symbolise data by attributes
• Apply transparency to map layers
• Project
• C:\QGIS_Training_Samoa\03_Workspace\2020_Samoa_QGIS_Training1
• Layers
We will use coastline boundary, roads, and location points (from previous Exercise 2) PLUS
some protected areas layers:
C:\QGIS_Training_Samoa\02_Datasets\Samoa_WDPA_Polygons.shp
C:\QGIS_Training_Samoa\02_Datasets\Samoa_WDPA_Points.shp
20
Labelling Features
In addition to changing the style, another way of displaying more information on your map is to use
labelling. You can label the individual features in a layer using any of the attributes relating to that layer.
• Open the Properties for the layer and go to the Labels tab
• Select the Label tab, in the top option select Single Labels and Label this layer box as below:
21
• Set this to the attribute you
want to label (Name)
• Select Text
• Colour to be Black
And lets give it a buffer to make the labels stand out from the data
22
• Select Buffer
• Click OK
Note: To turn the labels off you simply uncheck the Display labels box in the layer properties.
23
Save the project
24
Simple Symbology (Polygon)
When you add a layer to the map it will be loaded in a default symbology (i.e. colour, line thickness,
etc.). Modifying the default symbology of a layer is a simple task. You can change the symbology inside
of QGIS to make the map look the way you want. The changes that you make to symbology are relevant
to the current map only (i.e. if you add the layer into a different map it will open with the default
symbology again).
25
• Select Symbology
• Select Simple Symbol from the pulldown menu at the top of the dialog box
• Select Simple Fill
• Select Transparent Fill under the Fill Option
• Click OK
27
The output should look comething like this:
28
Point Symbology
• Right click the Samoa_WDPA_Points vector layer and select Zoom to Layer
• Right click the Samoa_WDPA_Points vector layer select Properties
• Click on “Simple Marker” to change the point symbol (the Marker)
You see that there are a variety of style options to choose from. We want to change our marker from a
circle to a red diamond (or whatever you want), change the colour and the size
• Click Apply to save the changes and apply them to the layer
• Then click OK to return to the map.
• The map looks a little messy so we want to make the Samoa_village_names not visible on the
map in order to make the protected areas stand out more. We can simply uncheck the layer
Samoa_village_names in the Table of Contents
29
• The results should look something like this:
30
Line Symbology
Changing the symbology of a line is similar to changing a point.
• Click Apply to save the changes and apply them to the layer
• Then click OK to return to the map. The results should look something like this
31
• Locate and press the Save Project As button
• Navigate to C:\QGIS_Training_Samoa\03_Workspace
• Save the project as 2020_Samoa_QGIS_Training2
32
Exercise 4 – Creating Maps
The following exercise will teach you how to create an output map that can be inserted into reports,
posted on web pages, or used for meetings and consultation.
By completing this exercise, you will learn how to perform the following tasks:
• Prepare a map that you can publish for reports, the web and/or meetings
• Vector layers
Polygon layer – Samoa_WDPA_Polygons.shp
Point layer – Samoa_WDPA_Points.shp
• Raster layers
Samoa_Sentinel2_L2A_01252020.tif
• Using the skills you have picked up already, add in datasets and set up the symbology and
labelling for your layers as per the following:
o Add in the Samoa satellite imagery raster layer
o Add in the layers Samoa_WDPA_Polygons.shp and:
1. Categorize the symbology to colour the polygons in a variety of colours by
designation (“DESIG”)
2. make the areas 50% transparent and
3. label polygons with NAME, set the opacity to 60% to make it transparent, set
the text size to 8
4. under Formatting tab there is a Wrap on Character option, this will let you
decide how to shorten the labels so they don’t overrun and look messy, we will
simply add a space here to make the labels more concise
5. add a buffer around the label and set the opacity to 60%
o Add Samoa_WDPA_Points.shp and label points with NAME and add white buffer, set
both to 50% transparent, and set the Wrap on Character option to have a space
33
Your screen should look similar to the image on the following page.
Print Composer
The Print Composer is the tool that we use to create an output map. The map can then be used in a
document, printed or emailed.
• Click OK
34
A new window will open. This is the Print Composer window (see next page) where we will put all of our
map elements together. There are several components to the Composer window, many are similar to
the QGIS work space. The main parts of the Print Composer window that we will be using are the:
Items Window
Print Canvas
There are many different tools in the Composer Items Toolbars. The more commonly used tools are
described below:
Save Project
Export as PDF
35
Add new scale bar to Print Canvas
Print Canvas
The Print Canvas is similar to the Map Canvas. This is where all the elements of a map are put together,
ready for publishing.
Items Window
The Items Window is where you edit all aspects of the Print Canvas and the items you have added to
the Print Canvas.
Before you begin to put anything on the map, the first thing that you need to set is the size of paper the
map will be published on. Right click on the Print Canvas and then select Properties.
Next we will start to add all the different elements to the page that we need to create a map.
Everything required for putting a map together can be found in the Composer Items Toolbars on the
left of screen and under the menu options.
Add Map
We will now add the map to the page, keeping in mind not to put anything too close to the edges
(printers have margins), and to leave yourself enough room to add all the other elements.
36
• Select Add Map tool from the toolbar on the left
• Click near the top left corner of the page and drag a box to the bottom right to insert the map
We will now look at how the map is positioned. Does it show the area we would like it to? Is there
enough space around the map to add a title, legend and scale bar?
To adjust the placement of the map on the page and the extent of the map we can use the following
map composer tools:
The select/move item tool allows you to select and reposition any element on the Print Canvas,
for example the box that the map is in or the legend.
The move item content tool allows you to reposition the map within its box.
Add Title
All maps should have a title. The purpose of the title is to tell the viewer what they are looking at.
37
This will add a small text box to the map (with the word Lorem ipsum inside) that you can now update
using the Item Properties dialog in the Items Window.
• Place Title text at the top and centre of the Print Canvas (use the red/blue guide lines to assist)
• Under Items properties – Appearance – Horizontal alignment, check the circle for “Centre”
38
Add Legend
We will now add a legend to our map. A legend provides valuable information to help people interpret
what a map is showing.
• Select the Add Legend tool from the Composer Items Toolbars
• Left click on the Print Canvas to add the legend
This will add the legend to your map with default settings, which will include adding an item for each
layer in the QGIS TABLE OF CONTENTS. We don’t need all of the layers displayed in the legend so we
will remove some of them.
• Use the Select/move item tool to position the legend on the right side of the page
39
Using what you have learned, try producing a legend like the one below:
• Select Add Scale bar tool from the Composer Items Toolbars
• Left click on the Print Canvas to add the scale bar
Now that the scale bar has been added to the map we will edit it further using the Items Window.
• Select the Add Image tool from the Composer Items Toolbars
• Left click in a white space on the Print Canvas and drag the cursor to create a box
40
You will now have an empty box displayed on the Print Canvas. Next, we need to import an image into
this box using the Items Window.
• Click Open
The Project logo should appear on the print canvas. Position the logo in the bottom left hand corner
under the map in the white space.
Repeat this process by adding a north arrow to the upper left hand corner of the map. North Arrows
can be found in the directory: C:\Program Files\QGIS 3.4\apps\qgis-ltr\svg\arrows\
41
Finalising and Exporting the Map
You now have all the elements that are required for the final output map. You should inspect the map
and the elements to see if they need rearranging and to check the map looks good.
• Resize and move the various map elements on the page to reduce the amount of white space
that is present (you may need to adjust font sizes etc. for the title and the legend)
When the map looks good and displays all the information you need in the best possible way, it is now
time to export it.
• Select the Export as PDF tool from the Composer Items Toolbars
• Save the PDF as ‘Samoa WDPA map’ to the file location C:\QGIS_Training_Samoa\04_Outputs
• Open your PDF once it has finished exporting and take a look at it
42
Exercise 5 – Navigating in QGIS
The following exercise will examine how to use the Table of Contents and to navigate around the map in
QGIS.
By completing this exercise, you will learn how to perform the following tasks:
We will rearrange some of the layers to change the display of data. A general rule to follow is place all
point vector layers at the top, followed by line vector layers, polygon vector layers, and with raster
layers at the bottom. By ordering your TABLE OF CONTENTS in this way, you will ensure that the
maximum amount of information is displayed on the map.
• Change the order of the layers in the TABLE OF CONTENTS by left clicking (don’t release the
click) and dragging a layer to a new position
• Order the layers so that point layers are at the top (i.e. Samoa_WDPA_points), followed by line
layers (i.e. Samoa_Roads_2016_OSM), then the polygon layer (i.e. Samoa_coastline) and at the
bottom the raster layer (i.e. Apia_Quickbird.tif)
43
Navigating the Map
Now that you have a project set up with some layers it’s time to move around the map and take a look.
You will find all of the navigation tools together on a Toolbar. There are Pan tools (these will move the
map around without changing the scale) and Zoom tools (these will change the scale and position of the
map).
Select (click on) these frequently used navigation tools to explore the map:
TOUCH PAN and ZOOM – allows you to use your laptop touch pad to pan (i.e. move around the
map) and to zoom in/out
PAN – click on the map and hold the click, to drag (move) the map around (note, the scale of the
map does not change)
PAN TO SELECTION – allows you to pan the map to the location of any selected features
ZOOM OUT – click the map or drag a box to zoom out from a location
ZOOM TO NATIVE PIXEL RESOLUTION – zooms to best scale for viewing the raster layers in the map
ZOOM FULL – zooms to the full extent of all layers in the map
ZOOM TO LAYER – zooms to full extent of the selected layer in the TABLE OF CONTENTS
ZOOM LAST – goes back to the previous view, before your last navigation action (i.e. ‘undo’)
REFRESH – if the map fails to draw, this will refresh the view
A regularly used navigation tool is the Zoom to Layer tool. This allows you to zoom to the extent of a
Layer.
• First use the Zoom Full tool till you can see all of Samoa
44
This will zoom you in on Apia harbour and show all the points associated with the Points of Interest
layer.
You can also zoom to a layer by selecting the layer in the TABLE OF CONTENTS and then right clicking on
the layer. This will present you with a list of options at the top of the list is “Zoom to Layer”.
45
Exercise 6 – Attribute Tables
The following exercise will introduce you to attribute tables and the data contained within them. It will
cover how to query information from these tables.
By completing this exercise, you will learn how to perform the following tasks:
• Project
C:\QGIS_Training_Samoa\03_Workspace\2020_Samoa_QGIS_MyProject.qgs
• Layer
Samoa_roads_2016_OSM
• Select the layer that you want to identify from the TABLE OF CONTENTS
• Click on a road feature in the map (it will open the dialog box with all the attributes for that
feature)
46
You may need to scroll across or resize the window to see all of the attributes and values associated
with that feature. If there are no features at the location you click then no dialog box will appear. If you
want to identify features from a different layer then you will need to highlight that layer in the TABLE
OF CONTENTS first before clicking on the map.
• Close the Identify Results box using the X in the upper right hand corner
• Right click the CSSP project total layer and select Open Attribute Table
47
Below is an example of how an attribute table may look.
Running across the top you have all the different attribute names (or columns) and running down the
side you have each the different records (or rows) of the table. Each one of the records in the table
represents a feature in the map. You can sort rows in ascending or descending order by clicking the
field names.
We are going to sort the table by the number of projects per village.
• Scroll across the Attribute table to the column titled ‘total PPV’
• Click on the column name
This time it should sort the table from highest to lowest value.
• Close the attribute table using the X in the upper right hand corner
48
Symbolizing by Attributes
For this exercise we will now combine our knowledge of Attribute tables and how to change the
symbology of a layer. Up until this point we have been symbolizing all of our data in a single layer the
same way, i.e. all the points are the same shape and colour. This works well for most data, but in some
cases we want to be able to distinguish between different attributes within the same layer (e.g. if we
have a roads layer that contains highways, sealed roads and dirt tracks we will want to illustrate each of
these road types using a different symbol in our map). To achieve this we can use the Categorized
option for symbology.
• From the Column drop down select PPV HML (see image below)
• Click Classify
Click Classify
Once you have the window populated with all the available values for an attribute you can then modify
the symbols of each as required.
49
Now we will change the symbol colours and fill.
• Double click on the symbol at the top of the list with no name
• Click on Simple fill
• Change the Colour Fill to Transparent fill (using the drop down box)
• Click OK
In the TABLE OF CONTENTS you will now see that under the CSSP project totals layer there are the 4
categories we have just made and they are labelled ‘Low’, ‘Medium’ and ‘High’, with the top one left
blank.
51
Selecting Features (optional extra)
There are 3 different methods that we can use for selecting features in the map, we can (1) select
features interactively in the map by clicking on them, (2) select them inside the attribute table, or (3)
build queries to select features. The first two are the simplest methods so we will explore them now.
• Click on one of the features (i.e. roads) in the map (it should highlight the road in yellow)
• Open the Attribute table for the road layer
The record for the selected feature (road) could be anywhere in the Attribute table so we will promote
it to the top so that you don’t have to go looking for it.
Selected feature
You should now see the selected feature (road) highlighted in the first row of the table. We have
selected a feature in the map and then shown this in the table; now we will do the reverse and select a
feature in the table and show it on the map.
52
• In the Attribute table select a different feature (road) by left clicking the grey area on the left
hand side
This should change the highlighted row to the one you have selected. You should notice that the original
feature (road) in the map is no longer selected. The link between the table and the map is always live.
Now we need to find this feature on the map.
• Click the Zoom map to the selected rows button in the Attribute table
53
This will take the map to the location of the feature (road) you have just selected.
This exercise has shown you how to select single features and show them in the table and on the map. It
is just as easy to select multiple features.
• Choose Select Feature(s) and draw a box around several roads in the map
• Open the Attribute table and click the Move selection to top button to see the result
54
You should have multiple records selected in the Attribute table this time.
You can select multiple records in the table as well, by clicking and dragging from inside the table.
• Experiment with the other selection tools in the drop down list so you understand how they work
• Try opening the Attribute tables in other layers and selecting features in those
When you have finished selecting features in the map and the Attribute table you can clear any
selection in the map by clicking the “Deselect Features from all Layers in the map” button.
• Clear the selected features using the “Deselect Features from all Layers in the map” button
55
Exercise 7 – Creating Shapefiles
The following exercise will take you through how to setup your own shapefiles for data management.
By completing this exercise, you will learn how to perform the following tasks:
• Create new empty shapefiles (vector layers) and populate them with attribute fields
• Raster Layer
Apia_Quickbird.tif
We are going to use this raster layer as the base to capture all of our information or data.
• Zoom your map into Apia city centre (use the image below as a guide)
Now that we have zoomed in on the area we are interested in we can start to create some empty
shapefiles (vector layers).
• Select Create Layer from the Layer menu, and then the New Shapefile Layer tool.
56
This will launch the dialog box below, for creating a new empty shapefile (vector layer).
We will break down each part of this dialog box so you can understand how to setup your first shapefile.
➢ File name – this is the name of the shapefile and location where you would like to store it.
➢ File encoding – this sets the format of the text for specific language characters such as ~ and
accent marks. We will use the default value of UTF-8 in our exercise.
➢ Geometry Type (Point, Multipoint, Line, Polygon) – this determines the type of geometry for the
data that you want to capture. Once you create the layer this part cannot be changed. Including
a Z dimension allows you to store three-dimensional data (such as elevation) and M values
allow for attributes to be stored with the vertex of the feature. We will not use either of these
for now.
57
➢ Coordinate System (Specify CRS) – This allows you to specify the coordinate system that you
want to use for your shapefile. You should choose the same coordinate system as used for the
satellite image, which also matches the coordinate system for your region (today we will use the
default coordinate system).
➢ New attribute – This is where we create the fields (columns) in our attribute table, which allows
us to capture data for selected features from the image. If you forget to add a field at this stage
it is not a big deal, fields can be added to a table at any stage. There are 4 different types of
fields that you can create:
o Text data – A field to hold text values (e.g. names of things, comments, etc.). The maximum
width for this field is 80 characters. When you create a text field you need to set the size
(width) of that field. Always allow for a few more characters than you think you will need.
o Whole number – A field to hold whole numbers (no decimal places). You need to set the
width of this field, i.e. the number of digits the field can hold (e.g. if you set the width to 3,
the maximum number you can input is 999). Always allow for more digits than you think you
will need.
o Decimal number – A field that can hold numbers that have decimals places. For this field you
need to set both the width (number of digits) and the precision (how many decimal places to
go to). The number of decimal places counts towards the overall field width (e.g. if you set
the width to 7 and the precision to 3, the maximum number you can input is 9999.999).
58
o Date – A field that can hold dates that use the “/” symbol. For this field you just need to set
the width, i.e. the number of characters (e.g. 10/11/14 would be 8 characters wide).
• Using the above as a guide create a new point shapefile using the following settings:
Type: Point
New Attribute
Name: Name
Type: Text data
Width: 50
• Click the Add to attributes list button to add the new attribute (see dialog box below).
By default, a new layer should already have the id field (which you should see in the Attributes list).
59
Your new shapefile layer should be automatically added into the map and appear in the TABLE OF
CONTENTS.
Type: Line
New Attribute
Name: Name
Type: Text data
Width: 50
• Click the Add to attributes list button to add the new attribute
• Now add a second new attribute with the following settings
New Attribute
Name: Length
Type: Decimal number
Width: 13
Precision: 3
• Click the Add to attributes list button to add the new attribute
• Click OK and save the shapefile to C:\QGIS_Training_Samoa\02_Datasets\Apia_Roads.shp
60
• Lastly, create a polygon shapefile with the following settings:
Type: Polygon
New Attribute
Name: Name
Type: Text data
Width: 50
• Click the Add to attributes list button to add the new attribute
• Now add a second new attribute with the following settings
New Attribute
Name: Type
Type: Text
Width: 20
• Click the Add to attributes list button to add the new attribute
• Click OK and save the shapefile to
C:\QGIS_Training_Samoa\02_Datasets\Building_footprints.shp
61
Exercise 8 – Creating and Editing Points and Polygons
The following exercise will introduce you to the feature editing tools available in QGIS. We will use the
zoomed in image from Exercise 6.
By completing this exercise, you will learn how to perform the following task:
Editing Toolbar
The Editing toolbar contains all of the tools that we need to create or edit the features in our map. This
toolbar is briefly described below.
Toggle Editing – This button will start and stop an editing session for a layer. You can edit as many
layers as you like but the layer has to be highlighted in the TABLE OF CONTENTS in order to edit the
features.
Save Edits – This will save the changes that you have made (i.e. new features you have created or
edits). When you toggle to stop editing you will be asked to save any changes you have made. It is a
good idea to save your work as you go.
Add Feature(s) – This is how you create new features on a map. Select this tool and then click on
the map to create new features.
Add Polygon Feature(s) – Use this tool to move a feature on the map. You select this tool then
click and drag the feature on the map to its new location.
Vertex Tool – Use this tool to move part of a feature. You select the feature first then use this tool
to reshape the parts of the line or the polygon that you want to move.
Simultaneous Attribute Edit – Use this tool to overwrite the attributes for one or more selected
features.
Delete Selected – This tool will delete selected features. You select the feature(s) using the
selection tools first.
62
Cut Feature – This tool will cut a selected feature.
Paste Feature – This tool will paste a previously cut or copied feature.
Undo Edit Feature – This tool will erase the last edit that was made.
Redo Edit Feature – This tool will readd an edit that was previously undone.
This will start an editing session for our point layer. You will see that more editing tools are now
available for use.
• If you are not already zoomed into downtown Apia, zoom into Apia
An input box will appear similar to the one below. This will allow you to input attribute values for the
point you have just created.
63
• Click OK to finish creating the point
We now have our first new point feature in the map. Next we will move its location.
• Click the Toggle Editing button (if you are not already in an editing session)
• Click the Select Single Feature tool (we used it in an earlier exercise)
• Click on the point to select it – the point will be highlighted yellow
Warning! This will delete the selected feature immediately. You can use the tool to delete more than 1
feature at a time if you like. If you delete the feature by accident you can use Undo Edit Feature to
restore it.
When you have finished editing the new layer you need to end the editing session and save your edits:
• Click Save
64
Creating and Editing Polygons
In this exercise we will create polygons for the empty polygon shapefile we created in the previous
exercise.
This will start an editing session for our polygon layer. You will see that more editing tools are now
available for use.
An input box will appear similar to the one below. This will allow you to input attribute values for the
point you have just created.
65
• In the id field write ‘1’
We now have polygon features in the map. We can edit, move, and delete polygons using the same
tools that we used in our point example above.
66
Exercise 9 – Importing GPS Data into QGIS
The following exercise will introduce you how to import GPS data into QGIS to view point locations.
By completing this exercise, you will learn how to perform the following tasks:
Using Excel or another text editor program, open the sample .csv file:
C:\QGIS_Training_Samoa\02_Datasets\GPS_Data\ Sample_GPS.csv
• In the ID field, type the name of the point collected in the field. This will help identify the point in
case there are any mistakes in data entry.
• In the X-coord field, type the x coordinate (UTM or longitude) of the waypoint.
• In the Y-coord field, type the y coordinate (UTM or latitude) of the waypoint.
• In the Notes field, please add in any description of the location of the point. For example,
northwest corner of a building, etc.
67
When finished, save the file as a comma delimited text file (.csv). In Excel, this can be done by choosing
the Save As button and select CSV (Comma delimited) option. When saving, Excel will ask you a couple
of times if this is the format you would like to use. Please select Yes.
Click the Add Delimited Text Layer button . A dialog box will open that will look similar to others
you have used to add in other data files.
68
• For File Name: Navigate to C:\QGIS_Training_Samoa\02_Datasets\GPS_Data\Sample_GPS.csv
• Layer name: you can name the layer whatever best represents the data collected
• File Format: please select CSV (comma separated values)
• Geometry Definition:
o Select Point coordinates
o X field: the field in the csv file that contains the x coordinates
o Y field: the field in the csv file that contains the y coordinates
o Geometry CRS: Select the coordinate system that the data were collected in
• Click Add
69
difference is you can change the file format option to GPS eXchange File [GPX] to specifically look for
GPX files.
Upon adding in the data, you will be prompted to specify which data you would like to add.
Select Waypoints to display point data that you collected in the field and select OK. Your point data will
now be loaded into QGIS.
NOTE: You can also drag and drop your GPX files into Google Earth for display.
70
Additional Resources
Free online guides:
Visit the main QGIS website: http://www.qgis.org/en/site/
71
72