QGIS Basic Exercise SRCS#
CSV in QGIS#
Aim of exercise#
In this task, we will load a CSV file in QGIS and do some analysis.
Task 1: Load data in QGIS#
Open the folder âExercise 2â. Go into the âdataâ folder and copy all data from the âinputâ folder into the âtempâ folder
To load the file âWater_sources.csvâ into QGIS click on
Layer
->Add layer
->Open Delimited Text Layer
. Next toFile name
click on the three points and navigate to your âtempâ folder. Her select the file âwater_sources.csvâ.Use the setings like in the image below.
Click
Add
Load the file âdistrict_pop_som.shpâ into QGIS
Tip
To directly load .csv or EXCEL data into QGIS, the datasets need to have columns containing geometry in the form of latitude (Y-field) and longitude (X-field).
Task 2: Counting water sources per district#
In the
Toolbox
-> Search forJoin attribute by location (summary)
Tip: If the
Toolbox
is not opne clickProcessing
->Toolbox
Input Layer
: Select your âdistrict_pop_somâ layerInput Layer 2
: Select âWater_sourcesâGeometric predicate
: Select âIntersectionâField to summarise
: Select âfidâSummaries to calculate
: Chose only the option âcountâUnder
Join Layer
click on the three points ->Save to File
and navigate to your âtempâ folder. Give the output the name âdistrict_watersourcesâ and clickSave
Click
Run
Video: impoering .csv
Task 3: Calculating water sources per 10.000 people#
Open the Attribute Table of âdistrict_watersourcesâ
Click on
Field Calculator
to open the field calculatorCheck
Create new field
Output field name
: Name the new column âWatersources_popâResult field type
: Decimal number (real)Add the code into the
Expression
field
( "fid_count" / "districtpo" ) * 10000
Click
ok
Save the new column by clicking on in the attribute table and end the editing mode by clicking on
Sorte the new column âWatersources_popâ and finde out wich districts have the highest and lowest number of water sources per 10.000 people
QGIS Intro#
Aim of exercise#
The goal of the exercise is to get to know the basic functionality of QGIS and how to handle geodata.
Task 1: Folder and data structure#
Save the folder Exercise_1 on your computer. Check out the folder structure in the Exercise_1 folder.
The standard folder structure used makes certain that you never lose any data. You can find more infos about the standard folder structure we recommend here.Please save your QGIS project in the âprojectâ folder.
Copy the data from the âinputâ folder into the âtempâ folder. During this exercise we will manipulate the input data, that is why we do not work with the original data in the âinputâ folder.
Tip
Intermediate results should also be saved in the âtempâ folder. The final results should be saved in the âoutputâ folder and your final maps in the âresultsâ folder.
Task 2: Data import into QGIS#
Open QGIS and create a new project by clicking on
Project
->New Project
(Wiki).To give the project a name click on
Project
->Save As
. Navigate to âExercise_1â and open the âprojectâ folder. Give your project the name âExercise_1â and click onSave
. Now you should see the name of your project in the upper left corner of your QGIS.Open the file âSomaliland_country.shpâ in QGIS. Click on the
Layer
Tab in the upper left corner ->Vector
. Select âSomaliland_country.shpâ. ClickAdd
(Wiki Import Vector layer)
Video: Import Vector data
Open the file Somaliand_District_pop.gpkg in QGIS. Use the drag-and-drop method. Click on the file and pull the file directly into your Layers window.
Video: Import data by drag and dop
Open the files âSomalialand_District_pop.gpkgâ and Somaliland_airports.gpkg with either drag and drop or via
Layer
->Vector
.Save your project by clicking on the
Save Project
button (small disc in the upper left corner).
Task 3: Interface#
Layers List / Browser Panel: The layers list shows all layers/files that are loaded in the project. You can show/hide layers and set other properties.
Toolsbars: Toolbars are shortcuts to execute frequently used commands. For example, there are special toolbars for vector and raster files, but also general ones for saving your project, etc. The toolbar contains, among other things, a list of all the commands you can use. The toolbar also contains the toolbox, which is used later in many of the wiki videos.
Map View: The map view is the central component of every GIS programme. This is where the geodata are displayed. The map view has a projection which does not always have to correspond to the projection of the layers.
Status bar: In the status bar you will find central information about the current map view. Here you can set the projection of the map view and the scale. You can read the coordinates of the mouse pointer and thus quickly find out the coordinates of points on the map. You can rotate your map view, e.g. if you want to create a map facing south.
Side Toolbar. You may see a side toolbar. This is another way to easily open vector and raster files in QGIS.
Locator bar. Here you can search for tools and layers. If you donât know where to find a tool, you can try here.
Task 4: Layer concept#
In this task, we familiarise ourselves with the layer window (Layer List). The concept means that a map in GIS is always a combination of multiple layers. We can combine the layers in many different ways and thus get different results.
You can find more infos in the Wiki Layer concept.
Switch off the âSomalia_countryâ layer by removing the check on the layer panel (Wiki).
Video: Show and hide layers
Video:
Change the hierarchy of your layers so that âSomalia_airportsâ is at the top, followed by âSomalia_District_popâ. Move the layer up and down in the Layer panel by drag-and-drop Wiki.
Video: Import data by drag-and-drop
Move the âSomalia_countryâ layer to the top and switch it on. What happens?
Change the name of the layer âSomalia_airportsâ to Airports by right click on your layer â>
Rename Layer
Video: Change Layer Name
To the properties of a layer right click on your layer ->
Properies
->Information
.When was the layer âSomaliland_district_popâ last modified?
How many features does the airport layer have?
What geometry does the Somalia_country layer have?
Task 5: Attribute tables#
The attribute table, a core component of Geographic Information Systems (GIS), organizes and presents detailed information about features in a selected layer. Each row in the table represents a feature, while columns store specific attributes. This table facilitates searching, selection, sorting, filtering, and editing of features.
Example of an attribute table
Open the attribute table of âSomaliland_district_popâ. Right-click on âSomaliland_district_popâ â>
Open Attribute Table
(Wiki)
Video: Open attribute Table
Sort by âPopulationâ by clicking on the column header.
In the attribute table select the feature âBerberaâ by clicking on the left edge of the row.
Video: Select features in Attribute Table
To select more features press
Ctrl
and click on the features.To only see selected features click in the down left corner of the attribute table on the drop-down menu and select
Show selected features
. To show again all features click onShow all features
.To only show unselect features and click on in the attribute table.
To unselect all features click on in the attribute table
Video: Unselect features
To zoom to one feature right click on your feature â>
Zoom To Feature
Task 6: Basic Data visualization#
Depending on the use case and type of geodata at your disposal, there are multiple ways to visualise geodata in a comprehensive format:
You can change the âstylingâ and color of the data
You can add textlabels
All the styling in QGIS happens in Symbology
To open the symbology window of the âSomaliland_countryâ layer right click on the Somaliland_country layer ->
properties
. A new window will open up with a vertical tab section on the left. Navigate to thesymbology
tab.
Video: Opening the styling panel
Change the colour of the layer fill by selecting a style for the drop-down menu.
To change the colour of the borders of the âSomaliland_countryâ layer by clicking on
Simple fill
in the symbology window and change the colour in theStroke Colour
drop-down menu.Adjust the thickness of the borders under
Stroke width
To only show the boarders of Somaliland click on
Simple Fill
->Fill Colour
->Transparent Fill
Video: Only display the outlines of polygons
Add a OpenStreetMap base map by clicking on
Layer
in the to left corner of QGIS ->Add Layer
->Add XYZ layer...
-> Select the OpenStreetMap
Video: Adding basemap
Task 7: Clipping and Extract by location#
Import the file Somalia_health_facilities_WHO.gpkg in QGIS.
Video: Import data by drag and drop
The layer Somalia_health_facilities_WHO includes health facilities in Somaliland and Somalia. We only want to use the facilities in Somaliland. To cut the layer to the size of Somaliland we will use the tool __clip. Open the
Porcessing Toolbox
by cliking onProcessing
-> search for âClipâ
Video: Open Processing toolbox
In the window of the Clip toolâŚ
Input Layer
: âSomalia_health_facilities_OSMâOverlay Layer
: âSomaliland_countryâClipped
: Click on the three points ->Save to File
-> search for your âtempâ folder -> give the result layer the name âSomaliland_health_facilitiesâ and click onSave
Click
Run
Video: Clip example
Now you should have a new point layer with all health facilities in Somaliland. Delete the old âSomalia_health_facilities_WHOâ layer by right-click on the layer ->
Remove layer
Task 8: Data visualization- Categorized classification of Points#
Categorized classification in QGIS groups spatial data into distinct categories based on specific attributes. This classification enhances the organization and interpretation of geospatial information for clearer insights.
Open the attribute table of âSomaliland_health_facilities_OSMâ by right clicking on âSomaliland_health_facilities_OSMâ ->
Open Attribute Table
Check out the column âFacility tâ. This column has the data on the type of the health facility. As you can see there are not just hospitals but many different typs of facilities like Health posts.
To categorise all facilities by type on the map, open the symbology window. Right-click on the âSomaliland_health_facilities_OSMâ layer ->
Properties
->symbology
Click on
Categorized
Value
: âFacility tâ. Further down the window click onClassify
. Now you should see all unique values or attributes of the selected âFacility tâ column.We only want to see the hospitals, so uncheck Maternal & Child Health Centre, Health Post and Health Center.
Click
Apply
Video: Categorized classification Example
To use a prearranged style for the hospitals go to the Symbology window. In the down left corner click on
Style
->Load Style
In the new window click on the three points . Navigate to the âProjectâ folder -> âStyleâ folder and select the file âHospital_style_training.qml. (Wiki)
Click
Open
. Then click onLoad Style
Back in the âLayer Propertiesâ Window click
Apply
andOK