QGIS is a full-featured, open-source, cross-platform Geographic Information System (GIS). The software has been developed by volunteers from the free and open-source software (FOSS) community and thus is well in-line with Ramani Huria’s approach of using open source tools whenever possible. QGIS runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities. QGIS also supports a number of plugins that can offer a user many additional features. One of these plugins is InaSAFE.

QGIS Interface

QGIS Interface

InaSAFE is a plugin for QGIS that produces realistic natural hazard impact scenarios for better planning, preparedness, and response activities. The software was developed jointly by Indonesia (BNPB), Australia (Australian Government), and the World Bank (GFDRR), and is being used across the world for disaster planning. One of the goals of Ramani Huria is for the data that we collect to be used for improving flood resilience – and InaSAFE helps to achieve this by allowing for wards across Dar es Salaam to have better insight on flood risk, ultimately enabling more effective disaster planning. .

InaSAFE helps to improve disaster preparedness by providing a new way to combine scientific hazard information and community knowledge on disaster risk. Hazards such as earthquakes, tsunamis, floods, and volcanoes, together with considerations of exposure, including people, buildings, and roads, are analyzed by inaSAFE to produce accurate impact and action maps for better planning, preparedness, and response.

The inaSAFE scenarios produced by Ramani Huria are based on flood hazard exposure information provided directly by the ward population. Below is the brief outline of this process.

Steps for creating inaSAFE maps

  • Wetland – we will use these to indicate which areas are flood prone
  • Worldpop 25 – this is a population raster taken from WorldPop and resampled to 25 meters. We also scaled the pixel values appropriately

The first thing we will do is add a column to the wetland layer to indicate which are flood prone. To do this, we need to use the ‘field calculator’ functionality in QGIS. Follow these steps:

  1. Select the wetland layer in the Layers panel and make sure it is highlighted
  2. Click on the table icon on the toolbar, or do Layer -> Open Attribute Table
  3. Click on the ‘Editing’ icon in the table toolbar
  4. Click on the ‘Field Calculator’ icon in the table toolbar and use the following options as shown in the image below:
    • Tick ‘Create a new field’
    • Set ‘Output field name’ to ‘FLOODPRONE’ (make sure you spell this in capital letters and exactly as shown).
    • Set the ‘Output field type’ to ‘Text (string)’
    • In the expression box, enter ‘YES’ (for this exercise we will be marking all wards as flood prone to start with)

  1. Click ‘OK’ in the field calculator to apply your changes
  2. Click on the ‘Editing’ icon in the table toolbar
  3. Press the ‘Save’ button to save your changes

Our wetland layer now has an extra column indicating that the area is flood prone. We will now try changing this particular wetland to ‘NO’ for its flood prone status to see how that impacts the analysis outcome.

Next,we are going to ‘register’ the layer with InaSAFE by defining keywords for it. To do this, we will use the Keywords Wizard. Follow the steps as shown in the series of screenshots below to register the layer as a flood hazard layer.

Select the ‘Wetland’ layer in the Layers panel and make sure it is highlighted (it may already be, which is fine)

Click on the ‘InaSAFE Keywords Wizard’ in the InaSAFE toolbar

In the steps that follow, indicate that the layer is a hazard, flood, wet / dry with attribute FLOODPRONE being the attribute that indicates whether the area is prone to floods.

On the next page of the wizard, we will indicate that the FLOODPRONE areas are those where the attribute value is ‘YES’. This is already done for you by default, there is no need to do anything so you can just press ‘Next’.

After selecting “hazard”, press ‘Next’ to select the type of the hazard layer represented,  which, in this case, should be “flood” as seen below.

Right after selecting “flood”, a window will appear for inputting data units. Select “wet / dry”.

After that, press “FLOODPRONE” to select the attribute in the layer that represents flood extents.

We are using a National Bureau of Statistics enumeration areas dataset, so we will set the source to ‘NBS’ and the url to ‘http://nbs.go.tz’. All the entries on this page are optional, so put in the best information you have available. Press ‘Next’ when you are done.

Add the source and URL of the source of the data that you use.

On the last page of the Keywords Wizard, you can enter a nice title for the layer. This will be used in the legend and in reports. For now let’s call it ‘Flood prone areas’.

Pressing ‘Finish’ will conclude the keyword creation process. You should now see your defined keywords in the dock area of InaSAFE.

Setting the analysis extent

We are nearly ready to run the analysis. Before we do that, we need to define what area should be used for the analysis. Click on the ‘Extent Selector’ tool

Use the dialog that appears, click ‘select on map’, and draw a box around the imagery area. Finally, press OK.

Running the analysis

At this stage, the InaSAFE dock should show that you are ready to run a flood analysis on the population. Press the ‘Run’ button to commence the analysis process. If everything was set up correctly, you should get a result in the dock area after a few seconds and a new map layer should be added to the map.

Note: The results layer may obscure all other layers – drag it down so that you can see the Ward boundaries over it. Now press the ‘Print’ button in the dock, and, without changing any options, press ‘Open PDF’ in the resulting print dialog.

Installing QGIS and InaSAFE

Installing QGIS and InaSAFE is a fairly quick and easy process. Both are free to use and can be installed on any operating system. Note that in order to use the InaSAFE plugin, you must first have QGIS installed.

  1. Install QGIS from the download page by selecting the correct option for your operating system. Once downloaded, install as you would any software.
  2. Once QGIS is installed (download it from http://download.qgis.org), open the programme.
  3. From the main menu, go to Plugins > Fetch Python Plugins and search for InaSAFE. Select it and click the ‘Install’ button. InaSAFE will now be added to the plugins menu. We encourage you to use the ‘LTR’ version of QGIS (at time of writing 2.8.2) since this will be the most stable version and we will always ensure that InaSAFE works with the LTR version of QGIS.
  4. The InaSAFE plugin is constantly being developed and it is also possible to install the latest test version, for more on this see the InaSAFE installation guidance.

Using QGIS and InaSAFE with OpenStreetMap

You can use OpenStreetMap data in QGIS, which is perfect for Ramani Huria as this is core to our mapping work. Layers in QGIS can also be saved as shapefiles, execute filters,  queries, and so forth.

There are a number of ways to access OSM data in QGIS. You can request data from the OSM server, similar to how you would in JOSM, but we recommend using the built-in download function in QGIS, which can be access by going to: Vector -> OpenStreetMap -> Download Data. For a step-by-step guide to importing OSM data and creating layers, see the section on QGIS on learnosm.org.

The InaSAFE website also provides a largest amount of data that can be downloaded to help you learn more about the tools and to practice scenarios with sample data. Using these examples is a great way to better grasp the features of InaSAFE.

QGIS and InaSAFE in practice in Dar es Salaam

Ramani Huria uses OpenStreetMap to create sophisticated and highly-accurate maps of some of the most flood-prone wards of Dar es Salaam. These maps can be used as the basis for analysis in InaSAFE and run realistic natural disaster scenarios for better planning and response based on the needs of the city. Our GitHub directory includes the QGIS project as employed by Ramani Huria to produce maps for outlining drainage and for general us. The map styles are based on the default OpenStreetMap look, but adapted to show more details on drainage, water network, building type, and landuse, amongst other features. Additionally, Ramani Huria is looking forward to working with the Tanzanian Prime Minister’s Office, Department of Disaster Management, in exploring the possibilities of using the data generated during this project to its fullest extent.

Learn more

Ramani Huria has conducted a two-day InaSAFE workshop in Dar es Salaam with the training materials that are available on GitHub, free to access and use. The materials also provide a case study of flooding in Dar es Salaam so you can see how QGIS and InaSAFE can be practically applied to the needs of Tanzania.

As both QGIS and InaSAFE have been developed by the free and open source software community, they have active online communities and many free training materials available. Here are a couple of places to learn more:

If you still have questions or need help, the Ramani Huria team is happy to assist you! Get in touch with us or come along to a Maptime Tanzania event where we can provide you with any advice you may need.