Skip to content

Commit

Permalink
deploy: e49cdf4
Browse files Browse the repository at this point in the history
  • Loading branch information
enauj committed Oct 24, 2024
1 parent 38b894d commit 918e2e8
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 133 deletions.
Binary file added _images/en_extract_by_expression_som.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/en_extract_by_expression_som2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _images/icon_scratch_layer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 41 additions & 36 deletions _sources/content/Modul_3/en_qgis_data_queries_ex1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

__🔙[Back to Homepage](/content/intro.md)__

🚧 This training platform and the entire content is under ⚠️construction⚠️ and may not be shared or published! 🚧

## Aim of the exercise

Expand All @@ -15,8 +14,8 @@ __🔙[Back to Homepage](/content/intro.md)__
* [Layer Concept](/content/Wiki/en_qgis_layer_concept_wiki.md)
* [Non-Spatial Queries](/content/Wiki/en_qgis_non_spatial_queries_wiki.md)
* [Spatial Queries](/content/Wiki/en_qgis_spatial_queries_wiki.md)
* [Table function - Add field](/content/Wiki/en_qgis_table_functions_wiki.md#add-field)
* [Geoprocessing - Clip](/content/Wiki/en_qgis_geoprocessing_wiki.md#clip)
* [Table function - Add field](/content/Wiki/en_qgis_table_functions_wiki.md)
* [Geoprocessing - Clip](/content/Wiki/en_qgis_geoprocessing_wiki.md)


## Data
Expand Down Expand Up @@ -55,54 +54,60 @@ The naming of the districts and states is not consistent across the different da
6. Now click `Run`
7. Adjust your layers in a way that you only see the flooded areas and your new layer **Beledweyne_buildings_affected**. Remove the `som_admbnda_adm2_ocha_20230308.shp` and `Buildings_Belete_Weyne.geojson` layer.

```{Attention}
The tool [`Select by Location`](/content/Wiki/en_qgis_spatial_queries_wiki.md#select-by-location) is very similar. This tool functions in the same way, but instead of directly extracting the features, it selects them.
```
```{Attention}
The tool [`Select by Location`](/content/Wiki/en_qgis_spatial_queries_wiki.md#select-by-location) is very similar. This tool functions in the same way, but instead of directly extracting the features, it selects them.
```
```{figure} /fig/Extract_by_location_Belet_Weyne.png
---
width: 400px
name:
width: 500 px
name: extract_by_location
align: center
---
The extract by extraction window in QGIS 3.36
```

6. In the next step, we want to identify special buildings among the affected buildings. Open the attribute table and check what kind of buildings can be found in the layer. This information can be found in the column "building". You can sort this column.
To extract "hospitals", "schools", and "mosques", we can use the tool `Extract by Expression` or `Extract by Attribute`.


::::{grid} 2
:::{card} `Extract by Attribute`
1. Find the tool `Extract by Expression` in the `Toolbox`.
2. `Expression`: click on ![](mIconExpression.png).
3. The window "Expression" will open. Here we can build a very specific query. In the central panel open `Field and Values`. Here you can see all the columns oft he the layer. Click on `building`. On the right-hand side, you should now see the option `All unique`. Click on it. Here you can see now all unique values in the column „building“.
4.





```md
"building" = 'hospital' or
"building" = 'school' or
"building" = 'mosque'
To extract "hospitals", "schools", and "mosques", we can use the tool `Extract by Expression`.
1. Find the tool `Extract by Expression` in the `Toolbox`.
2. `Expression`: click on ![](/fig/miconexpression.png).
3. The window "Expression" will open. Here we can build a very specific query. In the central panel open `Field and values`. Here you can see all the columns oft he the layer. Click on `building`. On the right-hand side, you should now see the option `All unique`. Click on it. Here you can see now all unique values in the column „building“.
4. In the `Expression` field, enter the following expression (see {numref}`extract_by_expression1`):
```
"building" = 'hospital' or
"building" = 'school' or
"building" = 'mosque'
```
5. Click `Ok`. The window will close and you will see the expression you created in the `Expression`-field in the `Extract by Expression` window (see {numref}`extract_by_expression2`).
6. Click `Run`. A new temporary layer called `Matching Features` will be added to your QGIS-project. Close the `Extract by Expression` window.

```{figure} /fig/en_extract_by_expression_som.png
---
name: extract_by_expression1
width: 400 px
---
The expression window in QGIS 3.36 with an expression to extract the polygons with the "buildings" value 'hospital', 'school', and 'mosque'.
```


en_extract_by_expression_som.png

en_extract_by_expression_som2.png
```{figure} /fig/en_extract_by_expression_som2.png
---
name: extract_by_expression2
width: 400 px
---
The `Extract by Expression` window in QGIS 3.36
```

Belet_Weyne_POI_affected.gpkg

:::

:::{card} `Extract by Expression`
In the learning modules, all relevant concepts and techniques of QGIS are explained, enabling trainees to reinforce their understanding of the training content.
:::{attention}
A temporary layer will not be saved to your QGIS-project, even after saving the project. Temporary layers are marked by a ![](/fig/icon_scratch_layer.png). In order to save the layer permanently, <kbd>Right Click</kbd> on the layer you wish to make permanent. Then, select the save location for the new layer. Make sure you to save it in the correct folder (see [standard folder structure](/content/Wiki/en_qgis_projects_folder_structure_wiki.md)).
:::


7. Explore the new layer by opening the attribute table, activating and deactivating the layer in the Layers panel.
8. <kbd>Right Click</kbd> on the `Matching Features` layer and save it to your project folder under `/data/output/` with the name `Belet_Weyne_POI_affected.gpkg`.

::::
Congratulations! The extracted information can now be used to perform further analyses or create comprehensive maps of the affected points of interest.

6. Find the tool `Extract by Expression` in the `Toolbox.
1.
<!--ADD picture of this step-->
64 changes: 43 additions & 21 deletions _sources/content/Modul_3/en_qgis_digitalisation_ex2.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,21 @@ In this exercise, you will learn how to digitise points, lines, and polygons of

## Instructions for the trainers

:::{admonition} A note on plugins
class: attention
This exercise makes use of a plugin which is not installed by default: `OSM Place Search`
Make sure you take a little bit of time to explain the role of plugins in QGIS and how to install them in QGIS.
Furthermore, instead of using XYZ-tiles for the basemap, you can decide to use the plugin __"QuickMapServices"__.
:::

:::{dropdown} __Trainers Corner__

### Prepare the training

- Take the time to familiarise yourself with the exercise and the provided material.
- Prepare a white-board. It can be either a physical whiteboard, a flip-chart, or a digital whiteboard (e.g. Miro board) where the participants can add their findings and questions.
- Before starting the exercise, make sure everybody has installed QGIS and has downloaded __and unzipped__ the data folder.
- Check out [How to do trainings?](/content/Trainers_corner/en_how_to_training.mdhow-to-do-trainings) for some general tips on training conduction
- Check out [How to do trainings?](/content/Trainers_corner/en_how_to_training.mdhow-to-do-trainings) for some general tips on how to conduct a training.

### Conduct the training

Expand Down Expand Up @@ -92,30 +99,40 @@ In 2022 there was a cash shortage in Nigeria. Small businesses heavily rely on c

Our goal is to create a point layers at the three Banks close to each other in the Central Business District (CBD) of Abuja in Nigeria. This is to let people easily identify the banks in the CBD of Abuja for their transaction purposes.

To this end, we will visualize the digitization of the First Bank, Bank of Industrie Building, and Zenith Bank Abuja.
To this end, we will visualize the digitization of the First Bank, Bank of Industry Building, and Zenith Bank Abuja.

### Add a basemap

1. Add the OSM as a base map. To add the OSM as a base map click on `Layer` -> `Add Layer` -> `Add XYZ Layer…`. Choose `OpenStreetMap` and click `Add`.
Arrange your layer in the `Layer Panel` so the OSM is at the bottom ([Wiki Video](/content/Wiki/en_qgis_basemaps_wiki.md))

```{Tip}
You cannot interact with a base map!
```
2. To add the plugin `OSM Place Search`, click on `Plugins` -> `Manage and Install Plugins…` -> `All` and search for `OSM Place Search`. Once you have found it, click on it and click `Install Plugin`. You can open the `OSM Place Search Panel` like every other panel by clicking on `View` -> `Panels` and checking `OSM Place Search Panel`([Wiki Video](/content/Wiki/en_qgis_plugins_wiki.md#installation-of-plugins)).
3. In the panel, search "Abuja Central Business District" via the OSM Place Search in QGIS and choose Abuja Municipality Area Council, City. Zoom to the Central Business District. Here we want to digitise the location of banks. But first we need to create a new point layer.
To do that:
1. Click on `Layer` --> `Create Layer` -> `New GeoPackage Layer`([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#create-a-new-layer))
- Under `Database` click on ![](/fig/Three_points.png) and navigate to `temp` folder. Give the new dataset the name “Abuja_bank_point”. Click `Save`.
- `Geometry type`: Select `Point`
- Under `Additional dimension` you should always make sure that you check `None`.


2. To add the plugin `OSM Place Search`, click on `Plugins` -> `Manage and Install Plugins…` -> `All` and search for `OSM Place Search`. Once you have found it, click on it and click `Install Plugin`. You can open the `OSM Place Search Panel` like every other panel by clicking on `View` -> `Panels` and checking `OSM Place Search Panel`([Wiki Video](/content/Wiki/en_qgis_plugins_wiki.md)).
3. In the `OSM place search` panel, search "Abuja Central Business District" and choose Abuja Municipality Area Council, City. Zoom to the Central Business District. We want to digitise the location of banks in this region.
For this, we will need to create a new point layer:
1. Click on `Layer` --> `Create Layer` -> `New GeoPackage Layer`([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md))
- Under `Database` click on ![](/fig/Three_points.png) and navigate to `temp` folder in your project folder. Give the new dataset the name “Abuja_bank_point”. Click `Save`.
- Under `Geometry type`: Select `Point`
- Select the coordinate reference system (CRS) "EPSG:4326-WGS 84". By default, the QGIS selects the project CRS.
- Under `New Field` you can add columns to the new layer. Add the column “Name”.
* `Name` = “Name”
* `Type`: Select `Text Data`
* `Type`: Select `Text (string)`
* Click on `Add to Fields List` ![](/fig/mActionNewAttribute.png) to add the new column to the `Fields List`.
* Click `OK`.
* Your new layer will appear in the `Layer Panel`
```{figure} /fig/new_layer_abuja.png

```{admonition} Adding more information
class: tip
You can digitise even more information by adding more columns. For example, you can add a column for `amenity` to indicate the type of amenity (bank). Try thinking about what kind of data you can add.
```

```{figure} /fig/new_layer_abuja.png
---
height: 400px
name: New point layer Abuja
Expand All @@ -125,7 +142,7 @@ Create new point layer.
```

4. Now you can create a point for each of the three banks in the area [wiki](/content/Wiki/en_qgis_digitalization_wiki.md#add-geometries-to-a-layer). Currently the new “Abuja_bank_point” is empty. To add features we can use the `Digitizing Toolbar`. If you cannot see the toolbar `View` -> `Toolbars` and check `Digitizing Toolbar` ([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#creation-of-point-data)). ![](/fig/Digitizing_Toolbar.png)
1. Select the point layer “Abuja_bank_point” in the Layer panel. Go to the digitalization toolbar and click on![](/fig/mActionToggleEditing.png). Now the layer is in the editing mode .
1. Select the point layer “Abuja_bank_point” in the Layer panel. Navigate to the digitalization toolbar and click on![](/fig/mActionToggleEditing.png). Now, the layer is in the editing mode.
2. Search for banks on the map or use the OSMPlace search panel. Once you have found one, click on ![](/fig/mActionCapturePoint.png). Left-click on the feature you want to digitalize.
3. Once you click, a window will appear "Abuja_bank_point". Here you can add the name of the bank.
4. Repeat the same process for as many banks as you can find.
Expand All @@ -152,19 +169,20 @@ There is some reliable information that there is a roadblock due to construction
1. Click on `Layer` --> `Create Layer` -> `New GeoPackage Layer`([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#create-a-new-layer))
1. Under `Database` click on ![](/fig/Three_points.png) and navigate to `temp` folder. Give the new dataset the name “Abuja_roadbloc_polygon”. Click `Save`.
2. `Geometry type`: Select `Polygon`
3. Under `Additional dimension` you should always make sure that you check `None`.
4. Select the coordinate reference system (CRS) "EPSG:4326-WGS 84". By default, the QGIS selects the project CRS.
4. Select the coordinate reference system (CRS) "EPSG:4326-WGS 84".
5. Under `New Field` you can add columns to the new layer. Add the column “Roadblock_type”.
* `Name` = “Roadblock_type”
* `Type`: Select `Text Data`
* `Type`: Select `Text (string)`
* Click on `Add to Fields List` ![](/fig/mActionNewAttribute.png) to add the new column to the `Fields List`.
* Click `OK`.

6. Your new layer will appear in the `Layer Panel`
2. To digitise this area, click on your new „Abuja_roadbloc_polygon“ layer ([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#creation-of-polygon-data)).
- Clicking on ![](/fig/mActionToggleEditing.png) start `edit mode` and Add Feature: `Capture Polygone`![](/fig/mActionCapturePolygon.png)|.
- Draw geometries and enter `feature attributes`, "Roadblock_type" = "Construction_site".
- Save edits ![](/fig/mActionSaveEdits.png) , exit `edit mode`.


## Map the connection routes
A business man drove all the way from the North of Herbert Macauley Way in the Central Business District of Abuja to do transaction at the Bank of Industry on Monday morning. Unfortunately, he found that the network server of the bank is down and needed to proceed to the Zenith Bank as the only functioning Bank. He later discovered that there is a road blocked at the junction of independence avenue and Tafawa Balewa way due to road construction.

Expand All @@ -173,14 +191,18 @@ Create a road line layer that will allow him to get to Zenith Bank easily.
1. To do that we need again a new layer. In this case a line layer. The creation of that is nearly the same as for the point.
1. Click on `Layer` --> `Create Layer` -> `New GeoPackage Layer`([Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#create-a-new-layer))
- Under `Database` click on ![](/fig/Three_points.png) and navigate to `temp` folder. Give the new dataset the name “Abuja_bank_road_connection_line”. Click `Save`.
- `Geometry type`: Select `Line`
- Under `Additional dimension` you should always make sure that you check `None`.
- Select the coordinate reference system (CRS) "EPSG:4326-WGS 84". By default, the QGIS selects the project CRS.
- Under `New Field` you can add columns to the new layer. Add the column “Road_typ”.
* `Name` = “Road_typ”
* `Type`: Select `Text Data`
- `Geometry type`: Select `Line`.
- Select the coordinate reference system (CRS) "EPSG:4326-WGS 84".
- Under `New Field` you can add columns to the new layer. Add the column “Road_type”.
* `Name` = “Road_type”
* Click on `Add to Fields List` ![](/fig/mActionNewAttribute.png) to add the new column to the `Fields List`.
* Click `OK`.
```{admonition} Adding more information
class: tip
Again, by adding more fields, you can add more information. For example, you can add the type of road (e.g., paved, unpaved, highway, residential) or the speed limit, or the number of lanes. Try thinking about what information you could add, and which `Type` would you use? Keep in mind that you cannot perform calculations with string data.
```
* Your new layer will appear in the `Layer Panel`
2. Select the line layer “Abuja_bank_road_connection_line” to add data to in the Layer panel [Wiki Video](/content/Wiki/en_qgis_digitalization_wiki.md#creation-of-line-data).
1. Go to the digitalization toolbar and click on![](/fig/mActionToggleEditing.png). Now the layer is in the editing mode.
Expand Down
5 changes: 3 additions & 2 deletions _sources/content/Modul_3/en_qgis_modul_3_exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ These exercises cover all the content in Module 3.
| :-------------------- | :----------------- |:----------------- |:----------------- |
| __[Exercise 1: Digitisation](/content/Modul_3/en_qgis_digitalisation_ex2.md):__ | The objective of this exercise is to learn how to digitise points, lines, and polygons of real world objects in a settlements by creating a new dataset. The goal is to create data about the access to financial institutions in Abuja. | QGIS beginners, Knowledge about the QGIS interface and how QGIS handles geodata is required | 3 hours |
| __[Exercise 2: Classification](/content/Modul_3/en_qgis_classification_ex1.md)__ | The objective of this exercise is to create an overview map of the prevalence of stunting in Sierra Leone at district level. To do this, we will visualise both the prevalence of stunting and key infrastructure such as hospitals, airports, and roads by classifying the data. The decision on which data to visualise and how to present it is up to you, the cartographer. | QGIS Intermediates; A basic understanding of Geodata and the attribute table is required. | 3 hours |
| __[Exercise 3: Flood in Nigeria](/content/Modul_3/en_qgis_modul_3_ex1.md)__| The exercise evolves around the scenario visualizing the situation during the flood in 2022 in one state of Nigeria. You will work with administrative borders and population data from HDX. Furthermore, you will create your own geodata based on information from the field. In the end, you need to use categorised classification to visualize different datasets. | 4 hours |
| __[Exercise 4: Larkana Flood response](/content/Modul_3/en_qgis_module_3_ex2.md)__| In 2024, the provinces of Punjab, Sindh, and Balochistan in Pakistan experienced devastating floods due to intense and prolonged rainfall. The following analysis will utilize actual data from this natural disaster. The objective is to pinpoint the specific medical centers and healthcare facilities that were impacted by the flooding. Additionally, we will assess the viability of road access to the city of Larkana throughout the flood period. | 3 hours |
| __[Exercise 3: Data queries](/content/Modul_3/en_qgis_data_queries_ex1.md)__ | The aim of this exercise is to learn how to select and extract geofeatures using different methods in QGIS (extract by location, extract by attributes, and extract by expression) | 60 minutes |
| __[Exercise 4: Flood in Nigeria](/content/Modul_3/en_qgis_modul_3_ex1.md)__| The exercise evolves around the scenario visualizing the situation during the flood in 2022 in one state of Nigeria. You will work with administrative borders and population data from HDX. Furthermore, you will create your own geodata based on information from the field. In the end, you need to use categorised classification to visualize different datasets. | 4 hours |
| __[Exercise 5: Larkana Flood response](/content/Modul_3/en_qgis_module_3_ex2.md)__| In 2024, the provinces of Punjab, Sindh, and Balochistan in Pakistan experienced devastating floods due to intense and prolonged rainfall. The following analysis will utilize actual data from this natural disaster. The objective is to pinpoint the specific medical centers and healthcare facilities that were impacted by the flooding. Additionally, we will assess the viability of road access to the city of Larkana throughout the flood period. | 3 hours |
Loading

0 comments on commit 918e2e8

Please sign in to comment.