Exercise 4: Security Peshawar#

Aim of the exercise:

In this exercise, we will create a security map for a humanitarian team. In response to a recent cholera outbreak in Khyber Pakhtunkhwa (KP), the Pakistan Red Crescent Society (PRCS) and other Partner National Societies (PNS) have mobilized a team to this region. The primary objective of the team is to conduct a comprehensive assessment on the ground and facilitate coordination for any necessary future responses.

In order to ensure the safety of our team, we will create a map displaying security related information such as bomb threats. Additionally, we will take a look at data on armed conflicts and create an overview map showing the conflicts per thesil (subdistrict/ADM3).

In order to achieve this, we will use more advanced geoprocessing tools such as buffers and intersection tools and join two datasets using attribute table joins.

The exercise is split into three tasks:

  • In the first task, we will digitise security-related information as point data and create buffer zones to indicate high-risk zones.

  • In the second task, we will load a csv-file with data on conflict events that happened in Pakistan. We will use this dataset to find out the number of conflict events per thesil (subdistrict).

  • In the third task, we will load another csv-file with data on the multi-poverty-index (MPI) per district (ADM2). The Multidimensional Poverty Index (MPI) measures poverty by looking at more than just income. It includes things like education, health, and living standards to understand how people are poor in different ways. The csv-file does not contain explicit spatial information. We will add spatial information by joining it to a polygon layer containing the district boundaries.

Larkana Flood Response Exercise Track:

This exercise is part of the Larkana Flood Response Exercise Track.

However, the exercise can be done without completing the previous exercises.

These skills are relevant for

  • QGIS Essentials

  • Working with multiple layers

  • Conduct spatial queries

  • Creation of geodata

Estimated time demand for the exercise:

  • The exercise takes around 3 hours to complete, depending on the number of participants and their familiarity with computer systems.

Instructions for the trainers#

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? for some general tips on training conduction

Conduct the training

Introduction:

  • Introduce the idea and aim of the exercise.

  • Provide the download link and make sure everybody has unzipped the folder before beginning the tasks.

Follow-along:

  • Show and explain each step yourself at least twice and slow enough so everybody can see what you are doing, and follow along in their own QGIS-project.

  • Make sure that everybody is following along and doing the steps themselves by periodically asking if anybody needs help or if everybody is still following.

  • Be open and patient to every question or problem that might come up. Your participants are essentially multitasking by paying attention to your instructions and orienting themselves in their own QGIS-project.

Wrap up:

  • Leave time for any issues or questions concerning the tasks at the end of the exercise.

  • Leave some time for open questions.

Available Data#

Download all datasets here and save the folder on your computer and unzip the file.

Dataset name

Original title

Publisher

Download from

2024-01-01-2024-09-23-Pakistan.xlsx

Conflict data for Pakistan 01/2024-09/2024

ACLED

HDX

PAK_KP_admin_3.gpkg

Administrative Boundaries level 3 of KP

UN OCHA

HDX

Pak_adm2_Khyber Pakhtunkhwa.gpkg

Administrative Boundaries level 1 of KP

UN OCHA

HDX

20240605_PAK_MPI.xlsx

Pakistan Multi Poverty Index (MPI)

Pakistan Bureau of Statistics

Pakistan Bureau of Statistics

AOI_Peshawar.gpkg

Area of Interest (AOI) around Peshawar

Preparation#

  • Create a new QGIS project and save it into the exercise folder.

Task 2: Load Excel File containing conflict data into QGIS#

Context:

In this step, we want to get a broader overview of conflict events in Pakistan. The Armed Conflict Location and Event Data project (ACLED) distributes datasets on conflict events per country as excel spreadsheets. The datasets include dates, actors, locations, fatalities, and types of reported conflict events.

The dataset also includes geographic coordinates for each reported event. In QGIS, we can transform the datatable into a spatial dataset, such as a GeoPackage. Once we have the conflict events as point data, we can aggregate the data on subdistrict level and create a map showing the subdistricts (ADM3) most affected by conflict.

  1. Drag and Drop the ACLED conflict excel table 2024-01-01-2024-09-23-Pakistan.xlsx into your QGIS project.

  2. In the processing toolbox, find the tool Create points layer from table and open it.

    • As X Field select the column “longitude”, and as Y Field select “latitude”.

    • Under Points from Table , click on the three dots, choose ‘Save to GeoPackage’ and navigate to you temp folder. Save the layer with the name “Pak_Conflict_points_2024”.

    • Click Run.

../../_images/Create_ponts_from_table.PNG

Create points from table#

Great! We now have a point layer showing the conflict events in Pakistan. Now, we could investigate this dataset further by taking a look at the attribute table and see what kind of information is represented. However, we want to know the number of conflict incidents per thesil (subdistrict/ADM3). To calculate this:

  1. Import the layer PAK_KP_admin_3.gpkg from your data/input-folder into your QGIS-project.

  2. We want to count the number of conflict events per thesil (subdistrict/ADM3). To do this:

    • In the processing toolbox, find the tool Count points in polygon and open it.

    • As Polygons, select PAK_KP_admin_3-layer.

    • As Point Input, select the PAK_Conflict_points_2024.

    • Under Count, click on the ... and save the layer in your data/results/-folder as “PAK_num_events_adm3”.

../../_images/count_point_polygon.PNG

Count points in polygon#

  1. Open the attribute of your ‘Pak_num_events_adm3’ layer and scroll to the right. You will find a column with the name “NUMPOINTS”. Here you find the number of events per thesil.

    • Right-click on the layer and navigate to Properties –> Symbology. On the top change Single Symbol to “Graduated”.

      • In the Value field choose “NUMPOINTS”.

    • Then below click on Classify.

    • You can adjust the Mode and the number of classes if wanted. Also you can choose your preferred color ramp. You can try out different coloring options.

    • Once you are satisfied with the look, click ‘Apply’ and then ‘OK’.

Your result could look similar to this:

../../_images/Number_events_graduated.PNG

Number of conflict events per thesil#

Task 3: MPI data#

Context:

In this step, we want to visualise the Multi-Poverty index on district level (ADM2).

This can help us understand the economic and social vulnerability geographically. The data with the MPI index is available in an excel spreadsheet. However, it does not contain columns with the specific geographic data (such as coordinates). We have to find a way to join the data table with a spatial dataset.

  1. First, let us open the spreadsheet with Microsoft Excel or a similar program (such as LibreOffice Calc):

    • Here, you can already investigate the information that is stored in the different columns. Can you identify columns that contain spatial information?

    • For now, let us export the file as a CSV UTF-8.

      • Click on File -> Save As

      • Chosse an output folder, where it will be saved (the data > temp folder is recommended here) and give the file a meaningful name, for instance 20240605_PAK_MPI.

      • Choose the option CSV UTF-8 (Comma delimited) (*.csv) and Save.

    ../../_images/PAK_Excel_to_CSV.png

    Convert Excel to CSV#

  2. Open QGIS and create a new project. Save the project in your project folder.

  3. Import the layers __20240605_PAK_MPI.csv__ and Pak_adm2_Khyber Pakhtunkhwa.gpkg to QGIS:

    • Drag and drop the ADM2-layer into your QGIS-window.

    • To import the CSV-file, click on the Layer tab -> Add Layer > Add Delimited Text.

    • Browse for your 20240605_PAK_MPI.csv file.

    • Choose the correct File Fromat: Custom delimters -> Semicolon.

    • Go to the tab Geometry Definition and choose No geometry. We don’t have a column with coordinates or geoemtry information, but only the admin2 name and P-Code.

    • Add layer and close the window.

    ../../_images/PAK_Load_CSVfile.PNG

    Load CSV file to QGIS#

Now, we need to join the data to existing to the existing district boundaries (ADM2). This process is called a non-spatial join and it allows us enrich datasets using attribute data. In our case, the MPI dataset contains a column with the district names (admin2) and the P-Codes. P-Codes are international codes for administrative boundaries and are generally the best way to identify an administrative units, as names can have several spellings. Our polygon-layer also has columns with the p-codes.

So, we need to perform a non-spatial join using the P-Codes Columns as identifiers. To do this,

  1. Open the attribute table of the attribute table and detect the column which contains the information you want to use to join the data with the location. E.g. City name, district name, or best the P-Code. In our case it is ADM2_PCODE.

    • Hint: Each administrative level and area contains a worldwide unique code number. This helps to determine the exact administrative boundary without misspelling the name of the area.

  2. Now, we need the polygon layer with the administrative boundaries.

    • Open the attribute table for the layer Pak_adm2_Khyber Pakhtunkhwa.gpkg and locate the column containing the P-Code. How is it called?

  3. To link the two layers, open the Toolbox and search for the tool Join attributes by field value. Open it.

    • Input layer: Pak_adm2_Khyber Pakhtunkhwa.gpkg

    • Table field: admin2Pcode

    • Input layer 2: 20240605_PAK_MPI.csv

    • Table field 2: ADM2_PCOCDE

    • Choose a location to save the file as GeoPackage and give it a meaningful name, for instance MPI_Admin2_joined.gpkg

    • Run and close.

    ../../_images/PAK_joined_MPI_csv_admin2.PNG

    Join the districts with the MPI data#

    Info: You can see that not all areas are visible. Since we don’t have data for all districts, only the districts were linked with the csv on which we have MPI data.

    ../../_images/PAK_joined_MPI_csv_admin2_info.PNG

    Information of not joined and linked data#

  4. Visualize MPI_Admin2_joined.gpkg file: We have a new file, showing the district boundaries, but having the MPI information in the attribute table. The MPI value per district we now want to visualize.

    • Open the Symbology window of the file MPI_Admin2_joined.gpkg.

    • Decide which column you want to visualize. For instance the values of the year 2014 in the column A_2014_15.

    • Choose Graduate visualization.

    • Choose Value A_2014_15.

    • Click Classify.

    • Choose Mode Pretty Breaks.

    • Click OK and close the window.

  5. Visualize Pak_adm2_Khyber Pakhtunkhwa.gpkg layer for districts we don’t have MPI data on.

    • Open the Symbology window of the file Pak_adm2_Khyber Pakhtunkhwa.gpkg.

    • Change the color, maybe to dark grey, so we can differentiate between the districts we have and don’t have MPI data for.

  6. Add OpenStreetMap as a baselayer for better orientation.

../../_images/PAK_visualized_MPI.PNG

Visualized MPI data on district level#