Want to keep learning?

This content is taken from the University of Twente's online course, Geohealth: Improving Public Health through Geographic Information. Join the course to learn more.

Skip to 0 minutes and 7 seconds Hello, and welcome to this short tutorial in which we’re going to step through the exercise Access to TB Diagnostics in South Sudan. This exercise is part of the second video lecture, which focuses on raster-based analysis to determine spatial access to health facilities. So what we’re going to do is we’re going to work through this exercise document, which you see here on screen. I’ll take you through, step by step, to show you how this is done. The first part of this exercise shows you how QGIS works. We’ll go through that in a minute. And then we’ll go through, step by step, how a raster-based distance calculation is made. So here you see my folder structure.

Skip to 0 minutes and 51 seconds In here I have the folder that holds my data project, one which you downloaded from the internet. And the first step you’re asked to do is to open the QGIS file. This assumes you have QGIS already installed on your computer. So if you have QGIS already installed, you can simply double click this, and it will open the software.

Skip to 1 minute and 19 seconds And once opened, you will see an interface looking like this. This is the main interface of QGIS, and it already has some data preloaded. Now, if you go to the exercise, the first part of the exercise just explains to you how the interface works. And I’ll go over that now. So what we see here is the interface of QGIS. Here, on the top sides, you have various toolbars, ones which allow you to select, and pan, and zoom into your map. Then here, there is another toolbar, which allows you to load different types of data. For this exercise, we’ll not be using any of these. This here is called the table of contents.

Skip to 2 minutes and 2 seconds And here you’ll see a list of the various layers, which are currently loaded into this project. I’ll make this a bit wider so you can see properly. So here, for example, we have a point file, which you can switch on and off. It shows the location of TB diagnostics facilities in South Sudan. This here is a line layer of roads, which we’re going to use, in this case, to establish a network from which we’re going to calculate access. And here, this is the background. This is states of South Sudan. Another important part of the QGIS interface is your processing toolbox, which you can see here. I’ll quickly switch it off.

Skip to 2 minutes and 39 seconds So if you want to open the toolbox, you can just right click anywhere here on this toolbar area, and select the option Toolbox, which you can see here. That will show again.

Skip to 2 minutes and 52 seconds So the next step is that we’re going to just show you how to navigate in QGIS using zooming and panning tools. I switch back to the software. So here in the top area you have your toolbars. And here you can see this little plus, which is the Zoom In tool. I click it to select it. And now I just click and drag to select a certain rectangular area. If I release, you will see it will zoom into that area. Now, equally, we can zoom out. If I select the Zoom Out tool, I can, again, draw a rectangle here, and it will fit the current view into the rectangle draw. So see, it’s zooming out again.

Skip to 3 minutes and 30 seconds Now if we want to zoom out, back to the original extent, we use this little button here. If you click that, it will just zoom back to the total extent of your map. And the final nice navigation tool is this one here, which is your panning tool. If you select that, and click anywhere in the screen, you hold your mouse button pressed down, you can click and drag your map around. So it’s just a means of pulling and dragging your map up and down. And again, I’m going to zoom back to the original extent. Now I would advise you to practice this a bit to get familiar with these zooming tools.

Skip to 4 minutes and 6 seconds So it will help you keeping overview of your map when you’re working in a QGIS environment. So the next step in our exercise is to actually look at the properties of some of the layers. That’s what’s explained here. We’ll go through that now. So what this does is we’re going to look at the properties of any of these layers. How do we open the properties. Well, we select the layer in the table of contents. We right click it, and we select Properties.

Skip to 4 minutes and 35 seconds The properties windows will open, which you see here. It looks like this, and it has various tabs. There’s a General tab with normal information about the layer and the location where it’s stored, something on the coordinate reference system which is used. Then there’s the Style tab, and this is the one we are using quite a lot. This is where you set colorings. Then there’s labels, in case you want to label some features, fields, display, et cetera. Some other options which we’ll not be using today. So to go back to style, here we see the style of the current feature, which is the roads of South Sudan, and you see a line.

Skip to 5 minutes and 9 seconds And here you can select what type of line you want. So here you can select a type of line. And if you select the line, you can set a different color. For example, here we could change this to blue. And that will change to blue. Or we can set it back to purple. Then we click Apply, and it will switch back to purple. So this way, if you click OK, you can change the style of any of the layer. So, for example, this one, I’m going to select it, right click it, select Properties. There opens the properties. For style, I just change the color. So I select the fill, which you see here.

Skip to 5 minutes and 48 seconds And here I can select any different field. For example, if I want to have something purplish, I click Apply. The background turns purple. I’ll put it back to something neutral again. So I’ll make it back gray. Click Apply.

Skip to 6 minutes and 3 seconds So now we’ve quickly gone through the main interface, and some of the properties and functionalities of QGIS. I’m going to show you how to calculate a cumulative cost distance raster. So in this case, we’re now having vector lines. And because we want to calculate the raster-based distance, the first thing we’ll do is convert the line layer, which you see here in your table of contents that’s shown here on the map. We’re going to convert that into a raster. So how do we do that. We go up to the Process toolbox at this side of the screen, and we click Rasterize.

Skip to 6 minutes and 43 seconds You’ll see a number of tools opening up, and we just select the one– in my case it’s showing on top, because I used it before. Probably, in your case, it will show here at the bottom. I double click it to open it.

Skip to 6 minutes and 57 seconds And then here you have your rasterize options. The first thing we do is select your layer which you want to rasterize, which is our roads. The one shown here at the bottom, South Sudan roads. The number here refers to the geographic coordinate system, so that’s the one we want to select. And the next thing will be, the software asks you what property of roads do we want to have as a value of the raster cells. In this case, we want to have the speed of the roads, the maximum speed, which will be given to a raster cell where that specific line segment traverses through. So we select speed.

Skip to 7 minutes and 31 seconds Now in case there are multiple lines falling in the same raster cell, we need to choose which value it should take. In this case, we take the maximum value, so the maximum speed, which is allowed in the rasters that we take , assuming that people always take the fastest route, or the highest speed route. The final thing we need to change here is the cell size, which is currently set to 100. In this case, equivalent to 100 meters. And we’ll set this to something bigger to speed up the analysis. So just for the purpose of the exercise, we’ll set it to 1,000. So each cell of the raster will be 1,000 by 1,000 meters, or one square kilometer.

Skip to 8 minutes and 11 seconds And we click Run. So the tool will run, and now you can see something changing on the screen. And I’ll zoom in to see what happened. I’ll inspect a small area here in the center. What we can see there is a grid of raster cells, which now are overlaying the lines that we had. So these were the lines, now these are the grids. And each value of this grid corresponds to a certain travel speed.

Skip to 8 minutes and 39 seconds So now the next step, now that we have rasterized our line segments, we want to tell the software what to do with these areas where no roads were present. And in this case, because we’re dealing with South Sudan, we assume that not all the roads have been digitized. So we assume that some of the travel might occur outside of the road network. Therefore, at this point, we see there’s areas where there are no raster cells, there are no coverage, which are what we call no data areas. So I’ll switch it up for a second. So here in the background there’s light gray little areas where there were no lines.

Skip to 9 minutes and 16 seconds And we’ll give this another value of a certain value, which corresponds to a very low travel speed. That means that for the purpose for this exercise, some travel might be possible there. Of course, in reality, you would try to make it more realistic by adding topography, or natural barriers, et cetera. Here, we’re just going to set it all to a single travel speed. So how do we do this. Again, we go up to our processing toolbox here and we type “reclassify values.” And again, in my case, it will show up here, but in your case, it probably will show up here. We double click it to open the tool. It will open a tool.

Skip to 9 minutes and 58 seconds It asks us which grid we want to reclassify, which is the grid that we’ve currently loaded. And all we need to now is scroll all the way to the bottom so we can ignore, for a moment, everything that is happening up there. Then we say replace null data values, and we give our data value of 1, in this case. Another thing we need to do is just replace other values we have to deselect. So we want to keep all the values that are currently in our raster the same. This is all we need to do, and we just click Run. And the algorithm will run.

Skip to 10 minutes and 26 seconds And you will see there’s now a new layer here, reclassified grid, which gives you the same grid as we had before, but this time everything that has no data now has received a value of 1. So now we have reclassified all of this area. The next step is to transform these travel speeds into travel times. So currently each cell represents the estimated maximum speed that a person could reach while traversing through that cell. In order to be able to calculate a cost raster, we’ll need a costing value. In this case, we’ll use the simple time needed to travel through that specific cell.

Skip to 11 minutes and 10 seconds So as we know that the cells are one by one kilometer in size, and we know the value of each cell is the speed in kilometers per hour. What we can do is simply divide– take the inverse of the speed and multiply that by 60. So that means that I have 1 divided by the speeds, which will give you the fraction of an hour that will be needed to traverse a cell. And we multiply that by 60 to come to minutes. So how do we do that? We go to our QGIS, and we select in the main menu the option Raster. We select the raster calculator, which will open the raster calculator. This is the raster calculator.

Skip to 11 minutes and 51 seconds But there’s only a few things we need to do here. Here we can enter an expression. In this case, we just do 60. 60 is times 1, indeed, but we’ll fill in 60. And now we’re going to divide it by the grid values. The grid values are holding the maximum speeds, which is the reclassified grids, which you see here. So we can add it by simply double clicking it. So you see it’s now added to the expressions. So now we have the expression of 60 times the value of each cell in the reclassified grid. The last thing we need to do is define an output layer. And I’ll quickly just put this somewhere on my machine.

Skip to 12 minutes and 31 seconds I’ll put it in my trash bin here, for example. We’ll say Cross Grid South Sudan. We’ll call it number three.

Skip to 12 minutes and 43 seconds Save. So there we go. We’ve defined a cross grid to give it an extension, .tif, to make sure that it will be a TIFF file. Geographic format of the TIFF file, similar to what a normal picture has. And we just simply click OK. And it’ll run, and now the result has already shown up here in our output. I’ll just zoom back to the full extent. So there we go. We started off these roads, which we then rasterized. We reclassified the area that had no roads to 1, and then we calculated the estimated travel time to traverse through a cell. So now that we’ve done all these steps, we can actually proceed to calculate a cost distance raster.

Skip to 13 minutes and 30 seconds And again, we’ll go up here into our process toolbox, and we’ll simply type in “cost.” And again, the options recently used will show up here on top. In our case it will show up here. So we use the option r.cost.full Doubleclick to open it. There we go. In this case we only need a few parameters to be set. The first thing it asks is what is the cost raster. So how should it deal with traversing through the raster. What cost is involved. And that’s one we just created, which is the CostGrid_SSD3 we just saved in a previous step. So leave it to that.

Skip to 14 minutes and 9 seconds The start points here is automatically selected are the points of the health facilities, which we’ve loaded in our projects, the ones you see here. These will be the start points. Now in order to calculate the cumulative cost, there are multiple methods. In this case, we’ll use the Knight’s Move, which is a slow but more accurate method. So we’ll select that. Now you can leave all these other settings as by default. And we click Run to execute.

Skip to 14 minutes and 39 seconds And there you go. This is the output. So now we have the raw estimated travel time for each of these grid cells to its nearest health facility, which are the points that are shown. The final step in this exercise is to change the visualization of the raster lay, which is here in the back, because now it’s from white to dark. It might not be the type of coloring you would like, so we’re going to quickly change that. So how do we do that. So we open the properties of the layer that was just calculated. We select it, right click it, and select Properties.

Skip to 15 minutes and 13 seconds And from the properties interface, the dialogue, we go to the Style tab. Now here it says singleband gray, which is the current setting. We’ll change this to singleband pseudocolor. The interface will change. So now the next step, which you’ll see here, you’ll see that there’s a minimum value in your raster and a maximum value. These would correspond to 152 minutes up to 16000 minutes. So the minimum is not set to zero, but we’re choosing here to cut off the lowest values and the highest values. So we’re going to change this. We’re going to set the lowest value to zero. And the highest value, in this case, we’re going to set to 50, so the 50% of the area lowest values.

Skip to 15 minutes and 57 seconds Now to change these minimum maximum values you have to click Load here. And you’ll see a change from zero, in this case, to 2,708. Now we’ve set the range of values we want to display. We can choose a mode, which was set to continuous, and we just click classify. You’ll see here, automatically, a list of values will appear automatically. So these will correspond to the different travel times for this region. Now we click Apply, and the output will look like this. Personally, I like this not to be continuous, but I’ll choose a discrete visualization. I click Apply again. So there you go. So now we’re showing the whole area in discrete intervals by different time intervals.

Skip to 16 minutes and 55 seconds We could change these here, as well, if you would like. You can set them manually, if you want. So, for example, you could choose this to be 120 minutes, so two hours. 180 minutes, three hours. 360, six hours. Click Apply. And this is what the end result will look like. You’ll see the fast travel only occurs when you’re living close to one of these main routes. As soon as you move off, you’ll be more isolated. But still, this gives you an informative view of which areas might be under or over served. OK, so this is the end of this exercise. I hope you found it useful, and good luck practicing. Thanks a lot for watching.

Skip to 17 minutes and 39 seconds I hope to see you again next time.

Healthcare exercise using QGIS

The main objective of this case study is to become familiar with the main tools required to use QGIS. After you have become familiar with the tools you will calculate a cost distance raster in QGIS.

For this exercise you will use the locations of tuberculosis (TB) testing facilities in South Sudan which were made available by the National TB Program of South Sudan. You can download this exercise below.

Software for this exercise

For this step we are going to use the software called QGIS. QGIS is a free and open source GIS software package. This is a very simple yet very powerful piece of software.

The QGIS software is available for Windows, Mac and Linux. Please go to QGIS software website to get more information and start downloading the software.

The software is not available for smartphone operating systems, so you will need a desktop computer for this exercise. Please check out the common questions and answers on using this software properly. We cannot provide technical assistance in using this software in this course.

For this exercise a preconfigured QGIS project has been setup. You can download this project along with the data used in the exercise below

The exercise

If you have not installed QGIS you can download the software from the following location: https://www.qgis.org/en/site/forusers/download.html

Share this video:

This video is from the free online course:

Geohealth: Improving Public Health through Geographic Information

University of Twente

Get a taste of this course

Find out what this course is like by previewing some of the course steps before you join: