29.01.2015 Views

Practical Manual - Malareo

Practical Manual - Malareo

Practical Manual - Malareo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to<br />

Geographic Information<br />

Systems<br />

<strong>Practical</strong> <strong>Manual</strong><br />

QGIS for Malaria Page 1


<strong>Practical</strong> 1 Introduction to QGIS<br />

Outline<br />

Introduction<br />

Interface<br />

Menus<br />

Toolbars<br />

Map legend<br />

Map view<br />

Zoom/Pan/Bookmark<br />

Layers<br />

Adding<br />

Removing<br />

Visibility<br />

Viewing<br />

Saving<br />

Moving<br />

Types<br />

Points<br />

Lines<br />

Polygons<br />

Rasters<br />

INTRODUCTION<br />

This course assumes you have a basic working knowledge of computers and you know how to use<br />

Microsoft Windows and associated office software. It also requires a school level understanding of maps<br />

and mapping. In other words how to read a map and understand the concept of symbols representing<br />

points, lines and areas. There are basic mathematical operations such as basic Boolean logic and<br />

concepts required such as relative percentages. These are all required to effectively use GIS as a tool.<br />

GIS (Geographic Information System) is suited to epidemiology and mapping malaria as it allows you to<br />

map individual cases on a map where it was contracted. By mapping where the cases occur you can<br />

target the most affected areas appropriately and place resources where they are needed. By analyzing<br />

QGIS for Malaria Page 2


occurrences you can gain a better understanding of the spread of the sickness over time, such as when<br />

cases occur, are they linked to a particular event, such as a wet period<br />

QGIS is a desktop GIS, so named as it can be run on any desktop PC (Personal Computer). QGIS allows<br />

you to view, edit, analyze and output map or geographic (spatial) data. It uses amongst others, vector<br />

shape files (so called as the files have a .shp extension in the name) and raster layers to do this.<br />

Map layers (shape files) are loaded into the map legend one above the other and viewed in the map<br />

View / Display.<br />

There is a QGIS user manual which is also included in your root directory should you wish to delve<br />

deeper into the nitty grittys of QGIS.<br />

QGIS INTERFACE<br />

QGIS is opened by selecting it from the start menu in Windows, usually bottom left of your screen. Like<br />

most windows based programs it has its own window that can be minimized moved around or<br />

maximized on the screen. QGIS has a number of components that make up the program.<br />

QGIS for Malaria Page 3


These include:<br />

Menus such as: File, Edit, View, Layer and Settings amongst others and allow you to interact with the<br />

data and the program components.<br />

(These have drop down lists of all the tools and options available to you for use within QGIS).<br />

Toolbars contain shortcuts to selected icons representing many of the tools or options within the<br />

menus.<br />

(These allow one click access to the tool or option rather than having to search in the menus).<br />

The Status bar provides information on your map display and map layers, such as longitude and latitude<br />

(This helps you pinpoint locations and gives you information on the projection of the layers.)<br />

The Map Legend or table of contents (TOC) is where map layers are loaded and can be selected, and<br />

moved relative to one another in order<br />

(Layers are visible from top to bottom as if looking through a series of clear transparencies.)<br />

The Map view or Canvas is where the spatial data is viewed, essentially allowing you to view the map<br />

you are creating using the map layers in the map legend.<br />

(This is where you examine the map layers and change how they are represented to better<br />

express what you are attempting to show to the map reader.)<br />

Exercise 1. Opening a project<br />

Data can be added as individual layers to<br />

the map legend to make up a map. These<br />

layers can be manipulated (colors changed,<br />

line thicknesses altered) to create a map<br />

you wish to print or display. Once this is<br />

done the Map project can be saved. This<br />

saves all the settings used in the map. As a<br />

result you can open existing Map Projects.<br />

Open the Project called Africa.<br />

To do this left click on the Menu called File<br />

and select Open Project.<br />

Click on the drop down button to the right of the look in box and select navigate to the folder called<br />

malereo on your Local C drive (C:\malereo) folder.<br />

QGIS for Malaria Page 4


Once in the folder, using your mouse select (by left clicking on) the Africa.qgs project and click on open.<br />

This will open a thematic map (A map showing one<br />

attribute) of Africa Showing the number of cases of<br />

Malaria per 100 000 people in each country in 2008<br />

(WHO).<br />

Notice the Number of cases is assigned into classes<br />

to visually represent the severity of malaria cases.<br />

The QGIS window can be resized. To do this left click<br />

on the Maximize button in the top right of the QGIS<br />

Window. This expands the window to the maximum<br />

size of the screen and locks it in place.<br />

Menus<br />

There are 9 dropdown menus within QGIS, these allow you to interface with the software and the layers<br />

you have open.<br />

Exercise 2 Using menus<br />

Open the View Menu and select Zoom In. Using your mouse select a point to the south west of Libya,<br />

holding the mouse button down drag down to northern Mozambique. (A box will form showing the<br />

extent of your zoom and when you release it will zoom to the new extents. From the same menu select<br />

the identify item. Click on a number of the Countries, one at a time. Notice a identify results window<br />

pops up and relays information about each country. This is known as attribute information and is stored<br />

within the shapefile of the layer you are working with. In this case there is Country, Cases, Cases_km and<br />

Shape_Area.<br />

This is a major strength of GIS as you can query using both Spatial and attribute information.<br />

Within the View menu select Show bookmarks and select the Southern Africa bookmark. This “zooms”<br />

the Map view to the extents of Southern Africa. You can create your own book marks which make it easy<br />

to return to an area of interest while working with a map.<br />

Familiarize yourself with the menus and their contents, by opening each menu and scrolling down the<br />

menu. The file menu allows you to open and save projects and to print.<br />

The edit menu allows you to edit layers and features within layers<br />

QGIS for Malaria Page 5


View allows you to move around your view, zoom and identify features<br />

The layer menu allows you to add and remove layers and open attribute tables for the layers.<br />

Open the attribute table for Malaria_Cases_2008_WHO.<br />

The settings menu allows you to alter the settings within the software and project, such as changing<br />

your co-ordinate system.<br />

The Plugins refers to add on tools or programs that can be run within the program, for example<br />

interpolation.<br />

Raster allows you to undertake raster calculations on raster layers such as multiplying one layer by<br />

another.<br />

The vector menu has a number of sub-menus including tools for analysis and processing of vector data.<br />

Toolbars<br />

QGIS also contains a number of selected tools present within your Menus but made easily accessible by<br />

placing them on your main window. These tools are represented by icons and are arranged into<br />

separate toolbars allowing for a one click selection of a tool. The toolbars themselves can be turned on<br />

and off as they are needed or kept permanently on.<br />

As you move your cursor (pointer) with your mouse over each Icon, the name the tool represents<br />

becomes visible next to the icon, making it easy to find the tool you need.<br />

Find the icon that zooms to the full extent of your<br />

map (Zoom Full)<br />

Exercise 3 Using toolbars to add a vector layer<br />

Using your cursor find the tool to add a vector layer<br />

to your legend or project. The add vector layer<br />

window opens.<br />

Keep your source type as file and click on the<br />

Browse button in the Source section.<br />

Select the file Capitals_Africa.shp file and select open. This adds a new vector layer representing the<br />

capital cities for most Countries in Africa.<br />

QGIS for Malaria Page 6


Map Legend<br />

You now have 2 layers loaded into your map legend. Capitals _Africa and Malaria_Cases_2008_WHO<br />

Notice in the Map legend that each has a cross in a box to the left of the name of the layer. This<br />

indicates that the layer is displayed.<br />

You can make layers visible or non-visible by selecting the cross in<br />

the tick box. Click on the cross next to Capitals_Africa and examine<br />

the map view or canvas. Notice the layer is no longer visible. Play<br />

with the layer visibility for both layers.<br />

Layers can also be moved relative to one another. Using the mouse<br />

left click and hold down the left mouse button on the Malaria cases<br />

name in the legend. Keeping the left mouse button depressed drag the malaria layer upwards (A Small<br />

icon appears with 2 arrows). Drag it up and above the capitals layer. Note what occurs. Most of the<br />

capitals are no longer visible and are hidden under the countries. (You can still see a few present along<br />

the coastline.)<br />

This means that when displaying layers in QGIS you need to careful about the order you place your<br />

layers in. The general rule of thumb is points above lines above polygons.<br />

Move your layers back in order so that you can see them.<br />

Go to the file menu and select save project as: Name your project as your Name e.g. Joe and save it in<br />

the directory of your choice e.g. c:\temp\malereo\joe.qgs<br />

Saving a project stores the layers and their properties in a file which enables you to open it again and<br />

not have to reset all the properties. It does not however save any changes you have made to individual<br />

layers. This you will have to do separately when editing<br />

individual layers. And will be approached in a later<br />

practical.<br />

Map View<br />

The Map view is the area where you view the visible<br />

layers as listed in the Map legend. Here you can zoom in<br />

and out, View the layers and view labels of points, lines<br />

and areas. Any changes you make to the layer properties<br />

are reflected in the map view.<br />

Zooming<br />

There are a number of tools which allow you to interact with your view effectively. The ones you will use<br />

commonly are the Zoom tools. These are available both on the toolbar and in the View Menu.<br />

QGIS for Malaria Page 7


Use the Zoom in tool to zoom into South Africa. Place your cursor to the south west of south Africa and<br />

holding the left mouse button drag a rectangle over the extent of South Africa.<br />

Next you will Pan Use the Pan Map tool and Holding down the left mouse button drag the entire map<br />

southwards to show Botswana.<br />

Instead of having to use your Zoom out tool to get back to South Africa use your Zoom Last tool.<br />

Bookmarks<br />

You can also use book marks to Zoom to commonly viewed areas. Go to the view Menu and select Show<br />

Bookmarks. Select Madagascar. Notice the view shifts to Madagascar. Use the Zoom Full to Zoom back<br />

to the extent of the layers and create your own Bookmark for Eygpt and call it Egypt. To do this Zoom to<br />

Qygpt using your Zoom in and Pan tools, then select New bookmark from the view menu and type in<br />

Egypt. This stores a permanent bookmark that will allow you to instantly return to that view.<br />

Thus far you have had a brief introduction to the different components that make up the interface of<br />

QGIS and the layers and tools that are used.<br />

You will now look at layers and how you interact with them in more detail.<br />

LAYERS<br />

There are 2 main types of Layers that are used in GIS. These are Raster and Vector.<br />

Raster Data<br />

Raster layers consist of a grid of pixels, like a<br />

digital photo. The layer has a grid laid over it and<br />

each cell of the grid has a value, be that, a value<br />

representing red green and blue, as in an aerial<br />

photo, or a distinct value representing a theme<br />

such as soil type or malaria count.<br />

Exercise 4 Adding layers<br />

Add the raster layer Raster_cases to your map<br />

legend. Notice a single grey layer is displayed the<br />

approximate shape of Africa. Ensure you turn off<br />

the other layers in the map legend.<br />

QGIS for Malaria Page 8


Select the Identify features tool and select a<br />

number of pixels (one at a time around the<br />

continent.) An Identify results window pops<br />

up and shows the value at each point (chosen<br />

pixel).<br />

To Change the display to enable you to see<br />

differences right click on the raster_cases<br />

layer name in the map legend. A context<br />

window opens. Select Stretch using current<br />

extent. (This performs a contrast stretch<br />

using the minimum and maximum values of<br />

the layer).<br />

This illustrates that although the data is in raster format it is<br />

very similar to the vector layer showing the cases of malaria<br />

present in each country. It just has a very blocky pixilated<br />

appearance. Verify the data is similar. To do this turn the<br />

Malaria cases back on and highlight the layer. Then use the<br />

identify features tool. By changing which layer is highlighted<br />

in the map legend the identify features tool returns the value<br />

for that layer.<br />

Can you answer this Question<br />

How many cases did Mozambique have per 100 000 people in<br />

2008________________________________________<br />

Add the Tiff image Africa_150m_earthsat.tiff to your view and move it to the<br />

bottom of the map legend. You will use this layer in the visibility portion of the<br />

practical<br />

Removing layers<br />

There are a number of ways of removing layers. The first is to use the Layer<br />

Menu and select remove layer(s). This will remove the highlighted layer(s) in<br />

the Map legend. To select more than one layer at a time in the map legend<br />

hold down shift and left click on multiple layers.<br />

The second way of removing layers, which you will undertake is to right click<br />

on the layer raster_cases in the map legend. Ensure that only the raster_cases<br />

QGIS for Malaria Page 9


is highlighted, then right click on the layer name. This brings up a context menu, select remove from the<br />

menu. This removes the layer from the project. If you were to save the project it would not include the<br />

raster_cases layer. This is therefore different from turning a layer in the legend off. All layers can be<br />

turned on or off at once using “Hide all layers”. They can also be turned back on by selecting “Show all<br />

layers”.<br />

Visibility<br />

As mentioned above layers can be made<br />

visible or turned off using the tick box<br />

next to the name of the layer in the map<br />

legend. (You have done this already in a<br />

previous exercise) There are however<br />

other ways of changing the visibility of a<br />

layer. The way that layers are displayed is<br />

dependent on the properties of the<br />

layer.<br />

Exercise 5<br />

To view the Malaria cases layer<br />

properties right click on the layer and<br />

select properties from the context menu.<br />

This opens up a Layer properties window.<br />

There are a number of Tabs at the top of the page. The far left tab is the Style<br />

page. Select the style page tab if not already active by left clicking on the tab.<br />

Directly under the Style tab is a drop down which is currently set to Graduated.<br />

Left click on the small inverted triangle next to Graduated. A drop down<br />

appears with a series of options including Single symbol, Categorized and<br />

Graduated appear. Select Single Symbol.<br />

Now click Apply at the bottom right of the layer properties window and finally click Ok. Notice that the<br />

Malaria cases layer is now a single colour with solid black lines representing the country borders in your<br />

Map View. By modifying the style of a layer you can change how a layer is represented on the map view.<br />

Notice also that when you changed the style to single symbol the options within the style tab also<br />

changed.<br />

Notice next to the Unit Color is the word<br />

Transparency 0%. To the right of this is a<br />

slider. Drag the slider to 30% by left clicking<br />

and holding down the left mouse button and<br />

dragging the slider to the right. Notice the<br />

colour becomes less and less visible. Once at<br />

QGIS for Malaria Page 10


30% release it and click on Apply and Ok. Notice you can now see the raster layer which is a satellite<br />

image of Africa through the Malaria Layer as it is now partially transparent.<br />

Saving Layers<br />

When working with GIS data it is advisable never to work on your original data. The reasons are, if the<br />

software crashes or the user makes a mistake by deleting features or data the original unaltered data is<br />

still available from to start with again. It is also worthwhile saving in progress files if modifying or editing<br />

data. It is advisable to save copies atleast each day if not every few hours. In the following exercise you<br />

will make a selection of data and save that as a new layer.<br />

Exercise 6 saving a selection<br />

Open the Project called Selection. In order to save a selection you first need to<br />

make a selection. The easiest way to do this is to select by polygon. Find the<br />

tool on the toolbar or in the view menu that says “select features by rectangle”<br />

Hold down the left mouse button and drag a rectangle over the Southern<br />

African countries. You will notice they become highlighted in yellow.<br />

Right click on the Malaria Africa_2008 layer and select the “Save Selection as”.<br />

Choose your directory and call the output Southern Africa.<br />

You have now created a new layer of just the Southern African Countries.<br />

Add this layer to the Map legend to view the layer.<br />

Moving Layers<br />

Linked to visibility is how layers are viewed relative to one another. By selecting a layer in the Map<br />

legend, holding down the left mouse button and dragging, layers can be moved relative to one another.<br />

Take the Southern African layer and drag it to underneath the Malaria layer. Notice it disappears even<br />

though it is still in the map legend. It is worth checking the order of layers in the map legend if data is no<br />

longer visible.<br />

GIS data: Layer Types: Vector Data<br />

There are 3 Main Types of Vector data. These are point line and polygon.<br />

Line using Point nodes with Co-ordinates (X,Y) (Source: University of Washington ERM250)<br />

QGIS for Malaria Page 11


Point layers consist of an X and Y co-ordinate (and occasionally a Z (Height)). These can be in Geographic<br />

projection (Longitude and latitude), using the number of degrees in a compass direction from the<br />

Equator and Greenwich Meridian to give a point it’s relative position.<br />

Longitude:<br />

Latitude:<br />

Or they can be in a projected format, using metres measured along the earth’s surface again from a<br />

reference point or line.<br />

Examples of point data include households, Hospitals, Clinics, Schools, points of infection etc<br />

The usual format used is degrees decimal where the X is Longitude (lines running along the Globe) and<br />

Latitude Y with line running Around the globe e.g. 29.765437(E), -31.99864(S)<br />

Move your cursor around the screen and look at the status bar at the bottom of the screen. Notice the<br />

co-ordinates change as you move the cursor around the screen.<br />

Line layers are point layers that have the points joined by a line. These lines have a distance and<br />

direction associated with them, but the principal is the same, using x and y co-ordinates to specify nodes<br />

between lines. Examples include Roads, railways, Power lines, Rivers etc.<br />

Polygon layers are lines that have been joined to form a continuous line surrounding an area. The<br />

polygon has a perimeter and an area. Areas can be measured un Decimal degrees but it is prefereable to<br />

measure them in square metres or hectares. To do this it is often necessary to use a projected layer.<br />

Examples include Municipalities, Wards, Census districts, Dams, Cadastral (Property) boundaries etc.<br />

There are various levels of vector data. For example Country boundaries can be further broken down<br />

into Provinces, Then Magisterial Districts, and then Wards. In the following exercise you will look at<br />

various layers in map view to get an idea of the different types and scales of data.<br />

Exercise 7 Vector Data.<br />

Open the project Vector_Data.<br />

This project contains 6 layers. 3 polygon, 2 line and 1 point layer.<br />

QGIS for Malaria Page 12


It is important to note that although layers may represent the same general area, they may be collected<br />

at different scales and by different people and as a result may not match each other.<br />

When working with data you need to have a good understanding of what each layer represents. The first<br />

thing to do when examining data is to gain an understanding of what is being represented. What do the<br />

points lines and polygons represent This can be done by examining the layer name and then by<br />

examining the attribute table of the layer to see what the layer contains. Some data contains meta-data<br />

which is information about the layer and what it contains, its accuracy, date, file type etc.<br />

Open the attribute table for the Health facilities layer. (Right click on the layer and select open Attribute<br />

table.) Notice the 2 columns Longitude and Latitude. Notice the format of the information. Look at the<br />

various column headings. You can gain a better understanding of the data by looking at the attribute<br />

information.<br />

Name 5 of the types of facilities in this layer<br />

___________________________________________________________________________________<br />

Close the attribute table. Now right click on the Layer Power_lines and select zoom to layer extent. The<br />

map view zooms to show the layer at the maximum possible extent while still fitting the whole layer into<br />

the view.<br />

QGIS for Malaria Page 13


Open the attribute table. Notice there are no Longitude latitude columns but there is a shape length<br />

column. Notice the figures, (Very small numbers) these distances are in degrees, which are not constant<br />

dependant on where you are on the globe.<br />

To get an idea of distance you will now measure a length of<br />

Conductor. Go to the bookmark Measure. Select the measure line tool<br />

from the toolbar. Starting at the top left of the line using the left<br />

mouse button click along the line following the line to its end. Notice<br />

in the pop up window the distance is shown in metres and the<br />

distances increase with each added click.<br />

What is the approximate total length of the line<br />

Next you will look at the relative accuracy of layers. Open the bookmak Scale. This is an area on the<br />

Orange river on the border between South Africa and South West Africa<br />

Notice that while at full zoom differences between the layers<br />

are not visible, but when zoomed in you can see the lines<br />

although similar do not coincide. When undertaking analysis<br />

or editing data, this can cause problems. Be aware of the data<br />

you are using.<br />

Notice how the river has 2 lines (one on either side of the<br />

border representing the width of the river.) Also notice that<br />

the SA Provinces do not match the Boundaries for South<br />

Africa. (This is because they are from different sources and<br />

digitized (created) at different levels or scales. You can use<br />

the Zoom Last tool to zoom to the last view extent or zoom<br />

full to zoom to the full extents of all layers.<br />

Be aware of these issues when acquiring or using different data sets.<br />

Raster Data.<br />

Open the project called raster. This project contains a Digital elevation model, where each pixel<br />

represents the average altitude across that area of land in the country. The pixel size is 800m x 800m.<br />

Notice there are vector layers present in the Map legend. Turn these on. Do the rivers match the<br />

Elevation<br />

Zoom into a river. Notice the size of the pixels get larger as you zoom in while the vector lines stay the<br />

same thickness. This is one of the advantages of vector GIS over raster GIS. Symbols used to represent<br />

lines and points will stay the same point size irrelevant of scale or zoom. However pixels have a set size<br />

and will increase or decrease in relative size as you zoom in or out. Use the Zoom bookmarks to show<br />

this or zoom in interactively.<br />

QGIS for Malaria Page 14


Open your Identify features and examine the values of pixels for both Raster layers. Notice that although<br />

there are 2 Raster layers displaying elevation, only the Africa_Elev contains the actual height values. The<br />

colour image contains red green and blue values and cannot be used to determine altitude, but can be<br />

used to drape over an elevation layer to increase visibility or contrast. Use your transparency to make<br />

the Africa layer 70% transparent. Zoom to the full extent of your map and examine your map.<br />

Again it is important to know your data and determine what each layer represents.<br />

Challenges<br />

The following exercises are optional but allow you to interact more intensly with the software.<br />

Undertake the following:<br />

Create a map of Africa integrating the Africa Elevation data with the malaria_2008 cases data and Rivers.<br />

Save the output as a JPG image<br />

Using Any Project Zoom into South Africa at a scale of 10 000 000. (Use your scale window) and add the<br />

Rivers_SA layer.<br />

How Many Countries are there in the Malaria_Cases_2008 layer<br />

What is the Mean number of Cases for Angola, Zambia and Mozambique Combined<br />

Using the basic statistics tool, determine the Mean number of cases of Malaria across Africa<br />

QGIS for Malaria Page 15


<strong>Practical</strong> 3 Data capture, Preparation and digitizing<br />

Outline<br />

Introduction<br />

Acquiring Spatial Data<br />

Data Formats<br />

Opening Spatial Data<br />

Opening Attribute (Tabular) Data<br />

Creating Spatial Data<br />

From Attribute Data<br />

Preparation<br />

Conventions (Formats)<br />

Creating a Layer from CSV<br />

Digitizing Spatial Data<br />

Creating a New Vector Layer<br />

Points<br />

Scale and accuracy<br />

Snapping<br />

Lines<br />

Polygons<br />

From GPS<br />

Introduction<br />

A map is only as good as the data it contains. There is an old GIS acronym which is still applicable today:<br />

GIGO: Garbage In Garbage Out. If your data is poor, no matter how good your analysis or map making<br />

skills are and output will be weak. It is important to get the best possible data available and to ensure<br />

that your data capture is done in a standardized, systematic and reproducible manner. This practical is<br />

all about getting data into GIS.<br />

There are numerous data GIS packages on the market and as a result, different data formats that are<br />

used in GIS and CAD (Computer aided Design). This makes the task of standardizing important. QGIS is<br />

freeware and has been designed to function with numerous data types, these include:<br />

QGIS for Malaria Page 16


Acquiring Spatial Data<br />

There are numerous types of data available and the sources of these data are varied. The quickest and<br />

easiest source of data is the internet and a fair number of the coverages (layers) you are using come<br />

from the internet. However data often has restrictions associated with it, be that in terms of distribution<br />

or utilization. Often free data is made available for education and research but not for profit. Also as the<br />

data is free there is no guarantee of accuracy or content. This needs to be taken into account. A highly<br />

accurate source of data is usually government departments especially the Surveyor General of a<br />

country. Data providers can also be employed to acquire data, be that from aerial photography or<br />

individual GPS surveys or projects. How you source data is dependant on the needs of the project and<br />

the budgets available.<br />

GIS Data can be acquired from various sources or using various means. These include government<br />

departments, Data vendors, the internet, from a GPS, on screen digitizing, importing images and georeferencing<br />

them and importing CAD diagrams and converting formats.<br />

A number of sources of data include:<br />

Diva GIS http://www.diva-gis.org/gdata<br />

GeoSpatial Portal http://www.opengeospatial.org/<br />

Free Maplibray http://www.maplibrary.org/<br />

The Protected Planet (Conservation Areas) http://protectedplanet.net/<br />

The USGS http://glovis.usgs.gov/<br />

Therea re literally dozens of sites available for downloading data, each with their own requirements.<br />

Go to the DIVA GIS site on your browser and Download the Administrative boundaries for South Africa<br />

(if you do not have an internet connection these are available in your data folder.<br />

Most data is in a zipped format (8.zip or *.rar) and will need to be extracted into a usable data type or<br />

format. In most cases this will ultimately be as shape files.<br />

Data Formats<br />

There are numerous data formats that are used by different GIS systems. These include but are not<br />

limited to:<br />

ESRI Shape files (*.shp)<br />

ESRI Personal Geodatabase (*.mdb)<br />

ArcInfo Ascii (*.e00)<br />

MapInfo (*.tab)<br />

Microstation (*.dgn)<br />

Comma Delineated text (*.csv)<br />

QGIS for Malaria Page 17


Autocad (*.dxf)<br />

ERDAS (*.ecw)<br />

Geotiff (*.tif)<br />

Jpegs (*.jpg/jp2)<br />

ArcInfo ASCII (*.asc)<br />

These data types can be found by<br />

looking at the data type when you<br />

browse for layers in the add Vector or<br />

raster layer tools. When working with<br />

GIS it is possible to load carious<br />

different data types into one map.<br />

However it is advisable to standardize<br />

on one data type (convert data to one<br />

type) and work with one projection.<br />

The most common form of data type<br />

currently utilized in most arenas is the<br />

ESRI shapefile. It is seen as the<br />

industry standard. It is highly<br />

interchangeable between different<br />

systems and has been around for a<br />

long time (+-20 years). As a result it<br />

can be used in most GIS software<br />

packages.<br />

There is a move towards Geodatabases but often shapefiles as they are tried and tested, work well.<br />

Opening Spatial Data<br />

Previously you have opened a project and loaded layers. In this exercise you will start with a blank<br />

project and load different types of data to create a project.<br />

Open QGIS, you will be presented with a blank Map view with no data in the Map Legend. You will now<br />

load a series of Map layers.<br />

Load the Shapefile called Provinces_SA. This is a layer of the Provinces of South Africa as of 2006. To do<br />

this Select Add vector layer and Select Browse. From the Files of Type drop down Choose the type as<br />

ESRI Shapefile and select Provinces_SA_2006.shp and click on open<br />

QGIS for Malaria Page 18


This adds the shapefile to the legend and view.<br />

Next you will add a CAD layer consisting of the Provinces of Zimbabwe.<br />

Add a vector layer and choose DXF as the input type (This is an Autocad Format) Select<br />

Provinces_Zim.dxf from the Directory and select open. Notice it add a layer called entities map legend<br />

and places a series of polygons into the map view. Zoom to full extents to view the layers. Right click on<br />

the layer and open the attribute table. Notice there are no Province names associated with the polygons<br />

(this is a problem with importing CAD to GIS, as each separate layer including text entities are separate<br />

layers and as a result the labels are in this case lost.)<br />

Next you will import a geodatabase file for Mozambique. Start by selecting Add a vector layer and select<br />

the file type ESRI personal Geodatabase [OGR] (*.mdb *.MDB) and select Mozambique.mdb from the<br />

directory. Select open and Open again. This brings up an interface asking you to select a layer, Choose<br />

Provinces_Moz from the list and click on OK.<br />

This loads the Provinces for Mozambique into the Legend and onto your view. If you open the attribute<br />

table, notice the data assosciated with each polygon is still present, unlike with CAD.<br />

Next you will add a comma delimited Text file. There are 2 ways to do this. First as an attribute table by<br />

adding a vector layer and the second is as a spatial layer by Selecting Add delimited text layer from the<br />

layer Menu. This allows you to create a spatial layer from a text file You will undertake both.<br />

Select Add vector Layer and scroll down to the file type CSV and choose the Moz_Places.CSV<br />

Click on Open this add the attribute table to the legend, but does not add the Spatial entities.<br />

Opening Attribute Data<br />

To view the attribute table, Right click on the layer name MOZ_Places and<br />

scroll down the context menu to Open attribute table.<br />

In the Attribute table you will notice the fields and the data populating<br />

them, but there are no spatial entities in this instance as you have merely<br />

added a table to the map legend. Being able to import attribute data only<br />

is useful as it can then at a later stage be linked to a spatial layer using the<br />

QGIS for Malaria Page 19


attribute information for example the column called “name”. We will look at linking later in the course.<br />

Go to your file menu and choose save project. Choose a file name to save it as e.g. Southern_Africa.qgs<br />

and save it in your practical 3 Folder.<br />

You can now open the project directly instead of having to add each layer individually. However this<br />

does not preclude you from adding extra data to the project. The project can continue to grow or shring<br />

as you add or remove layers to get to the product you want.<br />

Creating Spatial Data<br />

In the exercise above you opened a number of different GIS layers. Each one was in a different format.<br />

You added:<br />

a shape file (provinces_SA.shp)<br />

a CAD layer (provinces_Zim.dxf),<br />

a geodatabase file (Mozambique.mdb)<br />

and finally a text file Moz_places.csv.<br />

Each one of these files is a different type of data with different properties. When working with GIS it is<br />

not necessary to work with just one type of data, however it is highly advisable. It is a good idea to<br />

standardize on one type of data as it removes possible errors or shortcomings of one of the data types<br />

you are using. For example CAD not having a complete attribute table when imported. (The labels<br />

(Attributes) are stored as a separate text layer)<br />

Data Preparation<br />

In order to ensure the data you are opening or creating is of suitable quality and of the standard require<br />

it is often necessary to ensure the data is properly prepared.<br />

The last data you added was a text file and was added as an attribute table. When adding a delimited<br />

text layer you are not limited to just adding it as an attribute layer. If the layer contains spatial<br />

information in the form of Longitude and latitude it is possible to add it as a spatial layer. You will<br />

undertake this now. First though you need to ensure the data is in<br />

the correct format and properly arranged.<br />

QGIS for Malaria Page 20


You will be creating a layer using a text file. In order to do this you must validate your data.<br />

Open the text file called Moz_places using excel.<br />

table.<br />

Expand all the columns to<br />

enable you to see the cell<br />

contents. In order to import<br />

spatial data from a table<br />

you require 2 columns, each<br />

one representing the X and<br />

Y location of each point you<br />

wish to show. You can<br />

name these X and Y or Long<br />

and Lat or any name as long<br />

as you can identify it in the<br />

Conventions<br />

Ensure that the columns f the X and Y co-ordinates are of type Number and check they have atleast 5<br />

but preferably 8 decimal places. Also check if the Y co-ordinate is negative (as you are south of the<br />

equator.) If you make it positive it will place your points upside down in the northern hemisphere.<br />

Other columns can be of type general as they will be text generally, however any numbers must be of<br />

type numeric. (For example population data etc.) Also at this stage check for spelling errors. Also make<br />

sure you have not transposed the X and Y columns as this is a common occurrence.<br />

Save the Excel Spread sheet as a csv file or close the table if all the data is in the correct format.<br />

Creating a Layer from CSV<br />

Create a new project. Using either the New project tool<br />

on the toolbar or the menu item under file menu or use<br />

the shortcut key cntrl-N<br />

This creates a blank new project.<br />

Select add delimited text layer from the layer menu<br />

This opens up The “Create layer from a delimited text<br />

file” window.<br />

Browse and find the csv file called moz_places<br />

QGIS for Malaria Page 21


Within the window select selected delimeters and choose comma as the type<br />

Choose X Y fields and select LONG for the X field and LAT for the Y field<br />

Select OK<br />

You are then asked to choose a projection. Use the default which should be WGS84 and select OK<br />

This creates a spatial layer of all the places within Mozambique. If they are not immediately visible<br />

zoom to layer extent<br />

To save this layer right click on the layer and select<br />

Save as<br />

Choose your format as Shapefile, Browse to your<br />

destination directory (Prac3)<br />

Leave the CRS as default<br />

and save it as Places_Moz.shp by selecting OK<br />

You have effectively added spatial data from a text<br />

file by creating a spatial layer in the form of a shape<br />

file.<br />

Often you are required to create data from an aerial photo or an image, in essence to simplify the<br />

image. For example an aerial photo or Google may contain trees, houses, roads, dams and rivers. You<br />

only need to see the houses and the rivers. You would therefore want to create layers that can be easily<br />

seen and kept separate for each feature you are interested in.<br />

The process of creating or modifying a vector GIS layer is called digitizing (Making it digital)<br />

Open the Project called Digitising. You will see and aerial photo called Howard_College. This is a<br />

panchromatic (Plack and White) tif image that is geo-referenced. It is an aerial photo of the Howard<br />

college campus where you are currently located. Notice as you move your cursor around the map it<br />

shows the location as being geographic 30.98…. and -29.86…. (This can be used as an indicator of the<br />

projection system used).<br />

Creating a New Vector Layer<br />

In order to start digitizing you will need to create a new layer To create a layer from the layer menu<br />

select New Shapefile Layer<br />

QGIS for Malaria Page 22


This opens a co-ordinate reference system selector. As the layer you are viewing (Howard _College) has<br />

a Geographic Co-ordinate system (Most Geographic co-ordinate systems use wgs84 as their datumn)<br />

you can select the WGS84 Co-ordinate reference system or projection.<br />

In the New Vector layer window you have the option<br />

to add attribute fields.<br />

You will add one more field called “Building”<br />

To do this, within the New attribute section type in<br />

“Building” next to Name<br />

Below this is a drop down option to choose the type of<br />

data. We will use Text Data as we are going to name<br />

some of the buildings. We don’t however need 80<br />

characters so change this to “50”<br />

Now click on the Add to attribute list and the field is<br />

added to the list of attribute fields (columns in the<br />

attribute table)<br />

Click on OK<br />

Select WGS84 and click OK.<br />

This presents you with the New vector layer window.<br />

It is here you select the type of vector layer you will<br />

create.<br />

We will create all three types of layers point, Line and<br />

Polygon, starting with point<br />

So select the type as point<br />

Leave the CRS ID as WGS84 as you chose in the previous<br />

step.<br />

This opens the Save as Window. It is here you get to<br />

name the layer you are creating. Within the File Name type “Buildings”, Make sure the directory you are<br />

saving it in is the Prac3 folder and Select Save.<br />

QGIS for Malaria Page 23


You will notice a new layer called Buildings with 4 small dots to the<br />

left of the layer name has been added to the legend.<br />

You are now ready to start digitizing.<br />

To start digitizing you need to make sure the layer you want to edit or digitize is selected (Highlighted<br />

within the legend) Then select the Toggle Editing tool Either in the Layer<br />

Menu or from the Toolbar<br />

You will notice that the Buildings Layer now has a Pen next to the layer name and not the 4 dots.<br />

This indicates that you are in edit mode.<br />

Use your zoom in tool to zoom into the building in the North east<br />

corner of the image (T shaped building with a dark Roof).<br />

Select your Add Point tool on the toolbar and select a point using<br />

your left mouse button at the intersection of the two roofs or a<br />

point as close to the centre of the building as possible. A Attributes<br />

window opens. Type In “1” as the id and “Administration” in the<br />

Building Field.<br />

Once complete click on OK.<br />

You will now see a coloured dot where you selected your point for the<br />

building.<br />

Add 4 more points one for each building you choose and call them<br />

Memorial Tower, Old Main, Social Science and Management.<br />

To stop editing, toggle editing off. You will be asked if you wish to save<br />

the changes. Select “Save”<br />

If you have made erros you have the option to discard.<br />

Cancel will return you to editing mode.<br />

To view your edits turn the Howard college image off and<br />

zoom to the Layer extents of the Buildings layer.<br />

Challenge:<br />

See if you can label the points on your own. (Hint:<br />

use the layer properties.)<br />

You should see a layout similar to the one shown.<br />

QGIS for Malaria Page 24


Next you will create a line layer (line layers are also refered to as polyline layers, poly meaning many) for<br />

the roads.<br />

To do this, add the layer HC_roads to the legend. (This is a blank line layer with attribute fields called<br />

Road and Length)<br />

Scale and accuracy<br />

An important consideration when digitizing , is the scale (Zoom) at which you will digitize. This is highly<br />

dependant on the needs tof the work you are doing and the required precision. If you zoom out too<br />

much you will not be able to see details in an image. But is you zoom in too much sometimes depending<br />

on the quality of an image you will also not be able to see a lot.<br />

This is shown below:<br />

Too zoomed out<br />

Too Zoomed in<br />

On the image on the left it is too zoomed out to allow for accurate digitizing (You need to be able to<br />

accurately or precisely follow roads. On the image on the right you are so far zoomed in that the image<br />

appears distorted. Therefore a balance needs to be found.<br />

It also helps to maximize the size of your QGIS window. This gives you a larger view of the layers.<br />

Maximize your GIS window. In order to set your zoom type 1:500 into the zoom window in the status<br />

bar at the bottom of the QGIS window. Of course if you are digitizing at a provincial level you would<br />

zoom out a lot more 1:10 000 for example<br />

In this case 1:500 is a reasonable scale to digitize at as it allows objects to be seen clearly.<br />

QGIS for Malaria Page 25


When working with lines and polygons it is often necessary to be able to join them. For example roads<br />

join at intersections. When digitizing roads, should share common points at their intersections. To<br />

ensure this happens you need to snap points to one another. To enable snapping Go to the settings<br />

menu and select Snapping options. This opens the snapping window.<br />

You will be editing the HC roads layer so you want to select HC_Roads and make it snappable. To do this<br />

check the box to the left of the name of the layer you wish to make snappable.<br />

The mode you want to use is to allow the roads to meet at vertexes (to share a common point)<br />

So choose vertex for the mode and then change your snap tolerance to 10 and change the units to<br />

pixels. What this does is if your cursor is within 10 pixels of a vertex the line you are digitizing will snap<br />

to this vertex. This also means you cannot have vertexes within 10 pixels of one another.<br />

Click apply and ok<br />

Start editing the layer.<br />

When digitizing a network for example roads or rivers you need to look for possible points of<br />

intersection with other lines. If there is a side road off the main road you need to place a vertex at the<br />

intersection point. This allows you to join another road at the intersection.<br />

Start digitizing by scrolling your image to the far right. You can see 2 rows of parked cars on either side<br />

of the road (visualize the road you came in on this morning (further east is the boom gate). Select the<br />

capture line tool from the digitizing toolbar. Move your cursor to the edge of the image and start left<br />

clicking along the centre of the road. Moving in a westerly direction there is na intersection to the north,<br />

make sure to place a vertex in the middle of the intersection keep moving left. You meet a number of<br />

intersections along the road. You then meet a turning circle go around the turning circle being aware of<br />

the road meeting it to the west. Eventually you will get back to the road where you wil move your cursor<br />

close to the line and select an exisiting vertex on the road. Once this is done right click. This brings up<br />

the Attributes window. Select id as 1 and the road as entrance. Don’t worry about the length at the<br />

moment.<br />

Click on OK. This section of the road is now digitised.<br />

QGIS for Malaria Page 26


Continue digitising the other roads around the campus,<br />

making sure you snap vertices to roads.<br />

Eventually you will run out of window to digitise in.<br />

When this occurs select the pan tool and drag the<br />

window eastwards so you can see more of the road<br />

network. Then reselect the capture line tool and you<br />

can cintunue digitising from where you left off.<br />

If you inadvertently don’t get a line to snap to a vertex<br />

you can use the Node tool. Select the node tool move<br />

your cursor over a a section of road. Left click to select<br />

the segment and then move your cursor dirctly over a<br />

node (vertex) on the line and left click again. You will<br />

see the vertex changes colour to blue. This indicates the<br />

vertex is selected. You can now move the vertex by<br />

dragging it by holding your left mouse button down with<br />

your cursor on the vertex and dragging it to another<br />

vertox or to the point where you want it moved.<br />

QGIS for Malaria Page 27


Once you are happy with your line layer you can toggle editing off and save the layer. Be creative with<br />

your road names.<br />

Polygons<br />

Digitising polygons is essentially the same as digitising lines. The difference is that a polygons must have<br />

congruent side and must not overlap. To ensure common boundaries enable the topological snapping<br />

option for the layer you are digitising.<br />

Within GIS dependant on the scale you are working at it could be preferable to digitise a point versus a<br />

polygon. For example: Tress can be represented as polygons or as points. If you want to show the<br />

location of a tree or it is preferable to use a point however if you are working with tree canopy’s and<br />

want to deternine area of all tree canopies then polygons would be preferable. The decision as to how<br />

to digitise is dependant on your need.<br />

Challenge:<br />

Create an polygon layer called HC_Buildings and digitise the outer extents of each building that you<br />

represented as a point in your buildings layer. Remember to name them.<br />

GPS data<br />

GPS units such as the Garmin or<br />

Magallan handheld units allow<br />

you to store waypoints and<br />

tracks as you move around. A<br />

prime example would be<br />

mapping the location of a<br />

homestead where a case of<br />

malaria was found.<br />

There are various formats that are<br />

used to transfer GPS data from the<br />

GPS units to GIS one of these is the GPX format GPS Standard Exchange Format. This can be used by most GPS<br />

units and GIS systems to transfer data. There are numerous freeware programs to download files should you want<br />

to create basic text files instead of importing them directly into a GIS. The include G7toWin and DNRGarmin.<br />

In this exercise you will import a GPX file into a<br />

new project and add a Spot image as a back drop.<br />

Create a blank project. Select the GPS Tools. This<br />

opens the GPS Tools window. Select the Load GPX<br />

file tab (top left tab)Browse to find the<br />

GPS_pnts.gpx file from your prac3 directory and<br />

select it. Make sure waypoint types are checked<br />

and click ok.<br />

QGIS for Malaria Page 28


If you are interested in seeing the format you can view the GPX file in notepad or a text viewer. As you can see this<br />

file was created by DNR Garmin as this file was downloaded using DNR Garmin software. The text format is<br />

however vastly different to a standard csv file. When working with GPS data it is often worth saving the GPS data<br />

into both a gpx and a csv file to ensure no loss of data.<br />

Next you will load the backdrop image. Add a raster layer called Umfolozi. This is a spot image clipped to the<br />

extent of the main study area. In this case the points are locations soil samples within Hlhulwe-Umfolozi Game<br />

reserve.<br />

It is always safer to save a GPS event theme (waypoint layer as a new shapefile and you can do so by<br />

right clicking on the layer and selecting Save as.<br />

This practical has introduced you to the concepts of acquiring data, opening data, importing data nad<br />

creating your own data through digitizing. The QGIS manual contains further details on Data capture and<br />

digitizing. The manual is included as a PDF in your course notes.<br />

QGIS for Malaria Page 29


<strong>Practical</strong> 4 Coordinate Reference Systems (CRS)<br />

Outline<br />

Project Coordinate Reference System<br />

Changing the default setting<br />

Enabling "On the Fly CRS"<br />

Layer Coordinate Reference System<br />

Determining the CRS of the layer<br />

Changing the CRS of the layer<br />

INTRODUCTION<br />

QGIS refers to its projection and datum environment as the CRS (Coordinate Reference System). QGIS<br />

supports 2700 known Coordinate Reference Systems, defined by the European Petroleum Group (ESPG)<br />

and the Institut Geographique National of France (IGNF). These are stored by QGIS in the SQlite<br />

database. QGIS also supports "on the fly" (OTF) projections. This allows one to define the CRS of each<br />

new layer "on the fly" without having to change the properties of that layer.<br />

When deciding on what projection to specify for the project you are going to be working on, it is<br />

important to take into account the types of analyses you will be doing. For example, if you are going to<br />

be working primarily with locations then a Geographic Coordinate System is sufficient. However if you<br />

are going to be doing any type of length, area or other spatial calculations, then it is important to use a<br />

Projected Coordinate System, and bear in mind the units that the system uses.<br />

(WGS 84 is a Geographic Coordinate System, UTM is a Projected Coordinate System and uses meters (m)<br />

as its units).<br />

QGIS for Malaria Page 30


PROJECT COORDINATE REFERENCE SYSTEM<br />

QGIS specifies, by default, the Global and Project CRS as WGS 84. This default can be changed. It is also<br />

important to be able to set the default action that is carried out when adding a layer that has no<br />

specified CRS. These functions are all carried out in the CRS Tab of the Project Options Window . This is<br />

accessed using the Settings Menu and then selecting Options.<br />

Changing the default setting<br />

<br />

Access the Project Options Window by clicking on the Settings Menu in the Menu Bar and<br />

selecting Options.<br />

<br />

This brings up the Options Window. Select the CRS Tab. It is here that the default settings for<br />

QGIS' CRS can be configured, as well as the default way in which QGIS responds to new layers<br />

that do not have a specified CRS. It is also here that "On the Fly" projections can be set as<br />

default.<br />

Set the Default CRS and OTF Projection Options<br />

Set the Default way that QGIS responds to layers with no specified CRS<br />

In the first section, the default Global and Project CRS is specified. This is done by clicking on the<br />

Select Button and choosing the default CRS of choice from the list.<br />

In the second section, the default way that QGIS responds to layers without a specified CRS is<br />

selected. In this there are 3 options:<br />

QGIS for Malaria Page 31


o<br />

o<br />

o<br />

Prompt for CRS: This option will open a window and request that the CRS of Layer be<br />

specified.<br />

Use Project CRS: This option will apply the default CRS of the Project to the Layer.<br />

Use default CRS displayed below: This allows the user to choose a default CRS that is<br />

different to the Project or Global default CRS to be applied to new Layers.<br />

The CRS dialog box contains 5 areas of importance:<br />

<br />

<br />

<br />

<br />

<br />

Enable OTF transformations<br />

List of available CRS<br />

Proj 4 Text, information from QGIS about the<br />

projections<br />

A search option to assist in locating a specific<br />

CRS. This search can be based on the EPSG<br />

code, CRS identifier, or CRS name<br />

Recently used CRS is a list of the most recently<br />

used CRS in QGIS. This is useful if there is a<br />

particular CRS that is used often.<br />

Enabling "On the Fly" projections<br />

QGIS supports "On the Fly" (OTF) Projections. This means that QGIS is able to reproject layers into<br />

different CRS without the need to permanently change the CRS. However, OTF is not activated by<br />

default and needs to be turned on. There are three ways in which to activate OTF.<br />

<br />

<br />

<br />

From within the CRS Tab of the Project Properties Dialog Box.<br />

Click on the CRS Status icon in the bottom right of the task bar.<br />

Enabling OTF by default in the Properties Dialog Box.<br />

QGIS for Malaria Page 32


Task 1: Changing the Default CRS in QGIS and setting OTF projections as Default<br />

<br />

<br />

Open a new QGIS project.<br />

Access the Project Properties Window.<br />

By default the CRS should be WGS 84.<br />

<br />

<br />

<br />

<br />

To change the default CRS, search the list of CRS<br />

and find Cape/UTM Zone36S. (Look in the Universal<br />

Transverse Mercator submenu).<br />

Once this has been found, click on it to select it.<br />

To enable OTF projections, check the box at the Top<br />

top of the window marked Enable "on the fly" CRS<br />

transformation.<br />

Finally Click on Apply, then OK.<br />

The Default settings for QGIS have now been changed. In<br />

order to continue, go back and change the default CRS back<br />

to WGS84. In the Project Options Window, make sure that<br />

the Default manner in which QGIS deals with layers without<br />

a defined CRS is set to Prompt for CRS.<br />

Task 2: Working with Layer CRS<br />

<br />

<br />

<br />

<br />

<br />

Open a new QGIS Project.<br />

Add the layer called Fire_Stations from the Projections Data Folder.<br />

Next add the layer called eThekwini from the Projections Data folder.<br />

You will notice that a window has now opened and we are required<br />

to specify the CRS of the eThekwini layer. This is because the<br />

eThekwini layer does not have an associated CRS/projection<br />

specified (there is no .prj or .qpj file).<br />

Select WGS84 as the projection and click ok.<br />

QGIS for Malaria Page 33


You will notice that the layer does NOT appear in the map, however it is available in the TOC.<br />

This is because the CRS of the 2 layers are different.<br />

Open the metadata tab of each layer and look at the Coordinate Reference System. Make a note<br />

of what CRS each layer is using.<br />

It is important to get these layers into the same CRS if they are to overlay properly in the map.<br />

Use the Zoom Full button to see where these layers are sitting.<br />

Right click and select Set Layer CRS from the context menu.<br />

Specify the CRS as WGS84.<br />

Click OK.<br />

You will see that the Fire_Stations layer has moved.<br />

You can now see the difference in<br />

position of the layers.<br />

Remembering that the default CRS of<br />

the project is WGS84 and along with the fact<br />

that the eThekwini layer now has a CRS of<br />

WGS84, we need to change the CRS of<br />

Fire_Stations to match that of eThekwini.<br />

<br />

Select the Fire_Stations layer.<br />

If you use the Zoom Full button again you will notice that the layers are now overlaying nicely.<br />

However of you look at the scale bar, you will notice that it reads 40000 degrees in length. This is<br />

obviously not correct.<br />

To get the correct scale it is necessary to move the project and layers into the Cape/UTM Zone 36S<br />

projection.<br />

<br />

First Set the CRS of each layer to Cape/UTM Zone 36S<br />

Finally chance the CRS of the project to Cape/UTM Zone 36S.<br />

<br />

<br />

Zoom to the extent of one of the layers.<br />

You will notice that the scale bar now reads 40km. This is an accurate scale.<br />

QGIS for Malaria Page 34


<strong>Practical</strong> 5 Tabular Data Queries<br />

Outline<br />

Attribute Tables<br />

Viewing Attribute Information<br />

Working with Attribute Tables<br />

Selecting Records<br />

Selecting Multiple Records<br />

Switching and Clearing Your Selection<br />

Basic Statistics<br />

Querying Data in Attribute Tables<br />

Search<br />

Advanced Search<br />

INTRODUCTION<br />

GIS data has two components:<br />

1. Spatial (geographic) data which can be viewed as points, lines or polygons on a map.<br />

Points Lines Polygons<br />

QGIS for Malaria Page 35


2. Attribute data which describes the spatial data and can be viewed as a table.<br />

The following terminology is generally used when referring to attribute tables:<br />

An attribute table is a tabular file containing rows and columns. Each row (or record) in the<br />

table is associated with one geographic feature while each column represents an attribute of<br />

the geographic features.<br />

A field is a column in a table. Each field contains the values of a single attribute.<br />

A record is a row in a table. Each record contains the attribute data for a particular geographic<br />

(spatial) feature.<br />

Task 1: Viewing attribute information<br />

<br />

Open QGIS and load the Africa layer from the Tabular Queries folder. In the Map Legend, rightclick<br />

on the name of the Africa layer and select Open Attribute Table from the menu that<br />

appears. Browse through the table of attributes.<br />

Task 2: Working with attribute tables<br />

<br />

<br />

Selecting records: Move the table so that both the Map and Table are visible. Use the<br />

record selector buttons on the left of the table to select individual records. Look at the map to<br />

see how the records you select are also highlighted on the map.<br />

Selecting multiple records: Select multiple records from the table by holding down the <br />

key and clicking the record selector buttons. Look at the map to see how the selected features<br />

are highlighted. Click the Selected button at the bottom of the table to show only the selected<br />

QGIS for Malaria Page 36


ecords.<br />

<br />

<br />

Switching and clearing your selection: Make sure that all the records are shown by clicking on<br />

the first record, holding the SHIFT button, scrolling to the last record and clicking on it. Switch<br />

your selection by clicking the Invert Selection button.<br />

Basic statistics: Click on the Vector menu, then select Analysis Tools and then Basic Statistics.<br />

Ensure your Input Vector Layer is Africa and the Target Field is POP_ CNTRY, then click OK.<br />

What is the highest population of a country within Africa<br />

What is the total number of countries within Africa<br />

What is the Mean Population<br />

Task 3: Querying data in attribute tables<br />

<br />

<br />

Search: It is possible to select records in the table based on the values of particular attributes. If,<br />

for example we wanted to know how many countries were landlocked, we would use the<br />

“Search” function to do this. Type “Y” (note it is case sensitive) and in the drop down menu<br />

select “Landlocked.” Then click on the Search button. You will notice at the top of the attribute<br />

table that 15 records have been selected.<br />

Advanced search: We are going to select the landlocked countries that use the Franc for<br />

currency. To do this we are going to use the “Advanced search” function.<br />

QGIS for Malaria Page 37


First, make sure that no records are selected. Then click on Advanced search. In the Search<br />

query builder window there are 3 separate windows namely, “Fields,” “Values,” and “SQL<br />

where clause.”<br />

In order to make our selection the first thing we need to do is select those countries that are<br />

landlocked. To do this double click on Landlocked in the first window, then click on the “=” sign<br />

and then click “Sample” button below the Values window. You will see 2 options, Y and N.<br />

Double click on the ‘Y.’ You should see in the SQL where clause window the phrase:<br />

LANDLOCKED = 'Y'<br />

Now, click on the word “And,” then double click CURR_TYPE, click on the “=” sign and then<br />

select “Sample” again. This time the list of all currencies shows in the Values window. Select<br />

‘CFA Franc.” Your full query should read:<br />

LANDLOCKED = 'Y' AND CURR_TYPE = 'CFA Franc'<br />

You can now click on the Test button to verify that you have entered a correct SQL query and a<br />

window will pop up that says 5 matching features were found. Click OK and have a look at the<br />

attributes of the 5 selected features (you may want to Show only selected features).<br />

Now run the advanced search again but instead of using And use OR. You will see that a whole<br />

lot more features have been selected. What do you notice about their attributes (taking note of<br />

currency and landlocked specifically) You can see that for advanced queries it is important to<br />

select the correct “operator” when joining 2 queries. And you should always check your results<br />

once you have run a query to see that you have results that make sense. In GIS it is easy to get<br />

results; you want to always be sure to have results that are meaningful in the context in which<br />

you wish to use them.<br />

QGIS for Malaria Page 38


<strong>Practical</strong> 6 Spatial Analysis<br />

Outline<br />

Spatial Queries<br />

Selecting by Feature Location<br />

Measurements<br />

Segment Length<br />

Distance<br />

Area<br />

Geoprocessing of Vector Data<br />

Intersect<br />

Union<br />

Clip<br />

Buffer<br />

Dissolve<br />

Geoprocessing of Raster Data<br />

Slope Analysis<br />

Aspect Analysis<br />

Rater Calculator<br />

INTRODUCTION<br />

Spatial analysis lies at the Core of the functionality of GIS. This is where most of the calculations are<br />

performed on which most decisions are made. It is through spatial analysis that patterns are discerned<br />

are relationships determined between objects based on their spatial relation to each other. This can<br />

include a single object and its location in space or multiple objects and their relation to each other.<br />

We will explore the various basis operations that can be performed using QGIS to determine different<br />

spatial relationships between objects. QGIS gives us many useful tools to carry out these calculations.<br />

QGIS for Malaria Page 39


Spatial Queries:<br />

When a person is working with multiple datasets (layers) it is often necessary to calculate specific<br />

relationships between objects in these layers. For example, it may be necessary to determine how many<br />

of object A occur within object B, or are within a certain distance of object B. This is done using the<br />

Spatial Query Plugin. This Plugin in found on the Menu Bar, under the Plugins Menu (Last Option).<br />

This brings up the Spatial Query Dialog Box. It looks like this:<br />

It has 4 different criteria:<br />

<br />

<br />

<br />

<br />

Select source features from:<br />

This is the layer from which the selection is to be made. This is known<br />

as the Source Layer.<br />

Where the Feature:<br />

This is where the type of calculation is selected, there are 5 options<br />

here. These are:<br />

o Crosses<br />

o Intersects<br />

o Is Disjoint<br />

o Touches<br />

o Within<br />

Reference Features of:<br />

This is where the second layer is specified. This is known as the Reference Layer.<br />

And use the result to:<br />

This specifies what is to be done with the result of the operation. Most commonly the result is<br />

used to create a selection in the Attribute Table of the Source Layer.<br />

It is important to remember that the Source Layer always refers to the layer from which you want to<br />

make the selection. The Reference Layer gives the terms of reference for that selection.<br />

QGIS for Malaria Page 40


Task 1:<br />

<br />

Open a new QGIS project. Add the KZN_vegetation and eThekwini_fires layers from the Spatial<br />

Analysis Folder.<br />

Now zoom to the extent of these layers. The question we will attempt to answer is:<br />

"How many Fires are within the Thicket Biome of KZN"<br />

It is not possible to run this query directly. A 2 step process is needed.<br />

1. Select the Thicket Biome from the KZN_vegetation layer<br />

2. Determine the number of Fires within this area<br />

In order to select the Thicket Biome, access the attribute table of the KZN_vegetation layer. Now use the<br />

Query function to select the records that are just "Thicket".<br />

In the bottom right corner, type: THICKET (in capitals) into<br />

the "Look For" section. Make sure that "Biome" is selected<br />

in the "In" section. Then click on "Search".<br />

Once this is done, all the records for the Thicket<br />

Biome will be selected and they will be<br />

highlighted. At the top of the Attribute Table<br />

there will also now be a count of the number of<br />

selected records.<br />

Once the correct records have been selected, it is now possible to perform the<br />

Spatial Query.<br />

Open the Spatial Query dialog box using the Plugins Menu on the Menu Bar. Make<br />

sure the following selections are made in the Spatial Query Dialog Box:<br />

Select source features from: ethekwini_fires<br />

Where the feature: Within<br />

Reference Features of: KZN_vegetation<br />

VERY IMPORTANT: make sure there is a box underneath KZN_vegetation that<br />

states: 23 Selected geometries, and that there is a X next to it.<br />

QGIS for Malaria Page 41


This means that only the biome we selected is being included in the calculation.<br />

And use the result to: Create a new Selection.Click Apply<br />

The Spatial Query window opens with the results of the Spatial Selection. In the Bottom left can be<br />

found the results. In this case the result is 84 of 323 records have been selected. It is now possible to use<br />

this window to define more spatial queries. It is also<br />

possible to base the next query on the results that<br />

have just been obtained from the first query. This is<br />

done by choosing the "remove from current<br />

selection" option in the "And use the result to"<br />

section.<br />

It is important to note that it is only possible to<br />

REMOVE newly selected records from the current<br />

selection after having performed a Spatial Query.<br />

The results of the Spatial Query can also be found in the<br />

Attribute Table of the Source Layer.<br />

Measurements<br />

One of the most common calculations that are performed using a GIS is the measurement of certain<br />

objects. These measurements can be either lengths (road segments, perimeters, boundaries) or<br />

distances (from one location to another).<br />

These calculations are performed using the measure tool.<br />

QGIS for Malaria Page 42


In order to make measurements in units of distance, it is important to make sure that the project is<br />

using a CRS that is in meters. The default CRS is WGS84. This is a Geographic CRS and its units are<br />

degrees. We need to change this CRS to one that uses meters. As the data is located in South Africa, the<br />

Universal Transverse Mercator (UTM) Zone 36S, with the Cape Datum will give the required CRS.<br />

Task 2:<br />

<br />

Open QGIS and add the eThekwini and eThekwini_Health layers from the Spatial Analysis folder.<br />

Note that the scale bar at the top is<br />

in Degrees.<br />

In order to change the map units to meters we must alter the Project CRS.<br />

<br />

Access the Project Properties by selecting Settings, then Project Properties from the Menu Bar.<br />

This brings up the Project Properties Window. Select the CRS Tab. This is where the CRS of the<br />

Project can be altered. To find the Universal Transverse Mercator (UTM) Zone 36S Coordinate<br />

Reference System with the Cape Datum, select Projected Coordinate Systems, Universal<br />

Transverse Mercator and scroll down till you find: Cape/UTM Zone 36S. Click on this CRS and<br />

then click on Apply and then OK.<br />

This has now changed the CRS of the project to Universal Transverse Mercator (UTM) Zone 36S, with the<br />

Cape Datum. Note the change on the scale bar from Degrees to Meters.<br />

<br />

As changing the CRS has moved the layers to a new location it is necessary to zoom to the new<br />

location. This can be done using the Zoom Full button on the Tool Bar.<br />

QGIS for Malaria Page 43


In order to measure the distance between 2 places, it is necessary to first determine where they are. In<br />

this example 2 health institutions will be used. The question being asked is:<br />

"How far is it from Umhlanga Hospital to Kingsway Hospital"<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Select the eThekwini_Health layer.<br />

Right click and select Open Attribute Layer<br />

In the bottom right hand corner is the basic search tool. Type Hospital into the Look For section<br />

and then select Category from the drop down list.<br />

Click on Search. This will select only the hospitals.<br />

Check the box in the bottom left hand corner that is marked Show Selected Only. This will<br />

change the display of the Attribute Table to show only the selected hospitals.<br />

Now manually select Kingsway Hospital and Umhlanga Hospital. Select both by using the Control<br />

Key.<br />

Now select the Measure tool.<br />

Make sure to click on the drop down arrow and choose Measure Line.<br />

Move the cursor over the map. You will notice the cursor changes to a crosshair.<br />

Now click on one hospital and move the cursor the other hospital. You will notice that a<br />

Measure Dialog Box appears. Make sure to RIGHT CLICK over the second hospital. If you left click<br />

QGIS will think you are measuring a segment of a longer line. We will look at this in the next<br />

section.<br />

The Measure Dialog Box has 2 sections:<br />

The larger window is the Segments Area. This lists each segment of the line being measured and<br />

its length in meters.<br />

The last window is the total line length in Kilometers.<br />

<br />

To end the measure session, click Close in the Measure Dialog Box.<br />

QGIS for Malaria Page 44


Now to measure along the length of a line. The example for this is to measure a part of a road. Before<br />

starting this exercise it is important to remove all our selections. To do this use the Deselect Features<br />

from All Layers Button.<br />

<br />

<br />

Add the eThekwini_roads Layer to the Table of<br />

Contents.<br />

Using the same technique as above, measure the<br />

length of the N3 Highway in eThekwini.<br />

It is also possible to measure the Area of a polygon feature. This is done using the same technique, but it<br />

is important to set the Measure Tool to measure Areas.<br />

Geoprocessing of Vector Data<br />

The Geoprocessing of Vector Data requires the use of different Geoprocessing Tools. These<br />

Geoprocessing Tools alter or transform a layer based on its Spatial Relationship to another layer. In QGIS<br />

the Target Layer, that is the layer, being altered or transformed, is known as the Input Layer and the<br />

layer being used for the alteration or transformation is known as the "Process" Layer, where "Process" is<br />

the tool that is being used. For example, when using the Clip Tool, the layer being clipped is the Input<br />

Layer and the layer whose boundaries are being used to give the reference terms for the clip is known as<br />

the Clip Layer.<br />

QGIS for Malaria Page 45


QGIS supports many different Geoprocessing Tools. In this<br />

exercise we will be looking at the Geoprocessing Functions:<br />

Intersect, Union, Clip as well as Buffer and Dissolve. All these<br />

tools are found under the Geoprocessing Context Menu, in<br />

the Vector Menu on the Menu Bar.<br />

<br />

Intersect, Union and Clip<br />

These are both overlay functions and they both have the same effect of Joining two layers.<br />

However the manner in which these layers are joined is slightly different.<br />

Intersect:<br />

This operation joins two layers, however the extent of the first<br />

layer is cropped to the extent of the second layer. All the<br />

attribute data from BOTH layers is retained in this operation.<br />

Union:<br />

This operation joins two layers, however the extent of both<br />

layers is retained. All the attribute data from BOTH layers is<br />

retained in this operation.<br />

Clip:<br />

This operation is also known as the "Cookie Cutter". In this<br />

operation a section of one layer is cut out based on the extent<br />

(boundaries) of another layer.<br />

QGIS for Malaria Page 46


Buffer and Dissolve<br />

Buffer:<br />

Often it is necessary to know what lies within a certain specific<br />

distance of a feature. This can be done by creating a Buffer, an<br />

area that is a precisely measured distance from the feature of<br />

interest.<br />

Dissolve:<br />

This function enables the simplification of a layer by joining<br />

(aggregating) features based on shared attributes.<br />

Task 3:<br />

<br />

<br />

<br />

Open a new QGIS Project and add the EThekwini and Health Layers from the Spatial Analysis<br />

folder.<br />

Open the Attribute Tables for both layers and have a good look at them.<br />

Intersect:<br />

Open the Intersect Window from the Geoprocessing<br />

Menu.<br />

Under the Input vector Layer select Health<br />

Under Intersect Layer select eThekwini<br />

Click on Browse and give the output shapefile an<br />

appropriate name. Make sure you are working in the<br />

correct folder.<br />

Click Ok. Select "Yes" when asked if you want to add the<br />

new layer to the TOC.<br />

QGIS for Malaria Page 47


Before<br />

After<br />

<br />

Union:<br />

Open the Union Window from the Geoprocessing<br />

Menu.<br />

Under Input Vector Layer select Health<br />

Under Union Layer select eThekwini<br />

Click on Browse and give the output shapefile an<br />

appropriate name. Make sure you are working in the<br />

correct folder.<br />

Click Ok. Select "Yes" when asked if you want to add<br />

the new layer to the TOC.<br />

Before<br />

After<br />

Task 4:<br />

Start a new QGIS project. Add the Provinces and National_Roads_SA Layers. You will notice that the<br />

road network is of the National Highways in South Africa. In order to get the National Highways in<br />

Kwazulu Natal province only it is necessary to Clip the road network to the boundary of Kwazulu Natal<br />

province.<br />

QGIS for Malaria Page 48


Open the Attribute Table for the Provinces layer. Select the Kwazulu Natal Province. It should<br />

highlight on the map.<br />

Clip:<br />

Open the Clip Window from the Geoprocessing<br />

Menu.<br />

Under Input Vector Layer select<br />

National_Roads_SA<br />

Under Clip Layer select eThekwini. Make sure<br />

that the "Use only selected features" box is<br />

checked under the Clip Layer.<br />

Click on Browse and give the output shapefile an<br />

appropriate name. Make sure you are working in<br />

the correct folder.<br />

Click Ok. Select "Yes" when asked if you want to<br />

add the new layer to the TOC.<br />

Before<br />

After<br />

<br />

Buffer:<br />

In order to make calculations based on proximity to features it is often necessary to create a<br />

buffer of specific size around those features. This makes proximity calculations easier. In this<br />

example we will calculate the number of health facilities within 2km of these National Roads.<br />

o<br />

o<br />

o<br />

o<br />

Turn off the Provinces and<br />

National_Roads_SA layers.<br />

Zoom to the project extent.<br />

Add the Health layer to the<br />

current TOC.<br />

Change the CRS of the Project<br />

to Cape/UTM Zone36S. This is<br />

important as we need to<br />

make calculations in meters.<br />

QGIS for Malaria Page 49


o<br />

Open the Buffer Window from the Geoprocessing<br />

Menu.<br />

Under the Input Vector Layer select<br />

National_Roads_KZN.<br />

Leave Segments to Approximate as default.<br />

Set the Buffer Distance to 2000 (this is in meters, so<br />

2000m = 2km)<br />

Make sure to check the Dissolve Buffer Results box. This<br />

makes sure that different segments of roads that are<br />

being buffered end up as a single feature, not multiple<br />

features. Give the output shapefile an appropriate<br />

name. Make sure you are working in the correct folder.<br />

Click Ok. Select "Yes" when asked if you want to add the new layer to the TOC.<br />

The result of the buffer is a new<br />

Layer. This layer lies on top of the<br />

layer it was created from.<br />

In order to calculate the number of<br />

health facilities within this buffer,<br />

we will use the Spatial Query Plugin.<br />

<br />

<br />

<br />

<br />

<br />

<br />

Open the Spatial Query Plugin.<br />

Set Select Source Feature From to Health<br />

Set the Where the Feature to Within<br />

Set Reference Features of to your Road Buffer Layer<br />

Select Create New Selection<br />

Click Apply<br />

QGIS for Malaria Page 50


The result window shows the number<br />

of health facilities within 2 kilometers of<br />

the National Roads.<br />

<br />

Dissolve<br />

In this example we will use the KZN_ municipalities layer to determine the Districts in KZN. Each<br />

District contains more than one municipality. Thus these District names are repeated for each<br />

municipality in that District. We can aggregate the municipalities layer to show just these<br />

Districts.<br />

o<br />

o<br />

o<br />

o<br />

o<br />

o<br />

o<br />

o<br />

Start a new QGIS project.<br />

Add the KZN_municipalities<br />

layer.<br />

Open the Attribute Table of<br />

this layer.<br />

Look carefully at the<br />

District Field. You will<br />

notice that districts are<br />

repeated. This is because<br />

there is often more than<br />

one municipality in a district.<br />

Open the Dissolve Window in the<br />

Geoprocessing Menu.<br />

Set the Input Vector Layer as<br />

KZN_municipalities.<br />

Set the Dissolve Field as District.<br />

Give the output shapefile an appropriate<br />

name. Make sure you are working in the<br />

correct folder. Click Ok. Select "Yes" when<br />

asked if you want to add the new layer to the TOC.<br />

QGIS for Malaria Page 51


Open the Attribute Table of the new dissolved layer. You will notice that it has been aggregated<br />

(condensed) to just the districts.<br />

Geoprocessing of Raster Data<br />

Quantum GIS also supports raster based analytical functions. These are Raster Based Terrain Analysis<br />

and Raster Calculator.<br />

In Raster Based Terrain Analysis there are 4 analytical functions: Slope, Aspect, Ruggedness and Total<br />

Curvature generators. We will concentrate on Slope and Aspect.<br />

Slope is the steepness, or gradient of a slope. It shows areas of steep and shallow gradient.<br />

Aspect is the direction that the slope is facing.<br />

Both of these functions rely on the map units being in meters, hence they require a projected<br />

coordinate system whose units are in meters. For this exercise the Cape/UTM Zone 36S projection will<br />

be used.<br />

The Raster Geoprocessing Tools are located in the<br />

Plugins Menu, under Raster Based Terrain Analysis.<br />

The Raster Based Terrain Analysis Window houses both the Slope and Aspect functions.<br />

QGIS for Malaria Page 52


Task 5: Slope Analysis<br />

<br />

Open a new QGIS project and add the layer called elevation_UTM. This is<br />

a DEM of eThekwini.<br />

Change the CRS of both the layer and the project to Cape/UTM Zone 36S.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Zoom to the layer extent.<br />

Open the Properties menu of the layer and change the Color Map to<br />

Psuedocolor. This is in the Style Tab of the Properties window.<br />

This now symbolises the layer to show the altitude differences.<br />

Open the Raster<br />

Based Terrain<br />

Analysis window.<br />

Select Slope as the<br />

Analysis<br />

Select<br />

elevation_UTM as<br />

the input layer.<br />

Give the output a<br />

name and make sure to save in the<br />

correct folder.<br />

Select GeoTIFF as the output<br />

format.<br />

Check Add Result to Project Box<br />

Display the resulting image as a Psuedocolor map.<br />

The resulting image is a raster layer showing<br />

the slopes of the image.<br />

QGIS for Malaria Page 53


Task 6: Aspect Analysis<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Turn off the Slope Layer.<br />

Open the Raster Based<br />

Terrain Analysis window<br />

again.<br />

Select Aspect as the Analysis<br />

Select elevation_UTM as the<br />

input layer.<br />

Give the output a name and make<br />

sure to save in the correct folder.<br />

Select GeoTIFF as the output<br />

format.<br />

Check Add Result to Project Box<br />

Display the resulting image as a Psuedocolor map.<br />

The resulting image is a raster layer<br />

showing the aspects of the image. Each<br />

color represents a different direction<br />

(North, South, East, West etc.)<br />

Task 7: Raster Calculator<br />

The Raster Calculator enables calculations based on existing raster layers. Calculations can be performed<br />

on a single layer to extract specific information, or on multiple layers, using each layer a function of the<br />

calculation.<br />

<br />

Open a new QGIS project and add the layer called elevation_UTM.<br />

Change the CRS of both the layer and the project to Cape/UTM Zone 36S.<br />

<br />

<br />

Open the Properties menu of the layer and change the Color Map to Psuedocolor.<br />

To access the Raster Calculator, select Raster from the Menu Bar and select Raster Calculator.<br />

QGIS for Malaria Page 54


Active Layers in the TOC<br />

Mathematical Operators<br />

Expression Area<br />

In order to perform a calculation we need to setup the calculation as an expression. This is done in the<br />

Raster Calculation Expression Area. To build this expression we use the layers from the Raster Bands box<br />

and the mathematical operators.<br />

We are going to answer the question: "Where in eThekwini is the elevation higher than 500 meters"<br />

The raster calculation expression for this is: "elevation_UTM" > 500<br />

<br />

<br />

If we had wanted to include the 500m height, we would have used the >= sign.<br />

To start the expression by selecting the layer. To do this double click the elevation_UTM layer in<br />

the Raster Bands box. This will add it to the expression box.<br />

Then single click the "greater than" operator (>)<br />

Then type in 500.<br />

<br />

<br />

<br />

<br />

<br />

You will notice a note in the bottom left hand corner of the Raster Calculator. This note tells you<br />

whether or not your expression is valid.<br />

Make sure you give the Output layer a name and check the Add Result to Project box.<br />

Select GeoTIFF as the output format.<br />

Display the resulting image as a<br />

Psuedocolor map.<br />

The areas in Red are those that are<br />

higher than 500m.<br />

QGIS for Malaria Page 55


<strong>Practical</strong> 7 Mapping Malaria<br />

Outline<br />

Introduction<br />

Managing Disease Data<br />

Incidence vs Prevalence<br />

Thematic Mapping of Prevalence<br />

Interpolation of Prevalence<br />

Introduction<br />

Malaria is a vector borne disease, and is one of the largest killers in Africa. It is carried by the anopheles<br />

mosquito which is mobile. While their lifespan is limited and their flight ranges limited the sheer number<br />

of mosquitoes make a significant impact. While mosquitoes feed primarily on nectar, they require the<br />

iron and protein from blood in order to procreate. The Female transmits the malaria virus when she<br />

inserts her proboscis through the skin and injects an anti-coagulant into the victim to allow her to suck<br />

blood from the bite site.<br />

In order to target and combat Malaria, one needs to identify where the disease is located. The<br />

distribution of Malaria changes with time, primarily due to the presence or absence of mosquitoes.<br />

Hence in winter (Drier months) there is less malaria due to fewer mosquitoes. Therefore to adequately<br />

map the disease an understanding of the presence of the vector is required.<br />

The most common means of identifying where the highest prevalence of malaria is located is obtained<br />

from medical records where cases of malaria are treated. This can locate where the case was<br />

contracted, giving a general area where the disease is commonly found GIS is a useful means of mapping<br />

the presence and absence of a disease.<br />

The study of diseases is known as epidemiology. There are numerous methods of determining risk and<br />

distribution of disease You will look at a number of statistically based methods to show where malaria is<br />

located.<br />

John Snow is widely regarded as the father of Epidemiology, when he used the presence of cholera<br />

cases to pinpoint the source of the infection in London, tying it to dirty water from a pump.<br />

In essence you will be undertaking a similar exercise.<br />

QGIS for Malaria Page 56


In this practical you will<br />

undertake a number of mapping<br />

techniques to show the<br />

distribution of Malaria in<br />

KwaZulu-Natal Similar to what<br />

John Snow did in London. The<br />

principles learnt will apply in any<br />

environment or country.<br />

Managing Disease Data<br />

Before working with spatial and<br />

attribute data it is essential to<br />

understand where the dat comes<br />

from and what each attribute<br />

refers to. The main data you will<br />

be using is the malaria_case-<br />

Health_facility.shp file. This file<br />

list the number of malaria cases<br />

that could be traced back to a<br />

location after treatment in a health facility. A patient arrives at king Edward Hospital in Durban with<br />

malaria. If the individual has not travelled outside of their normal residential area the case can be<br />

attributed to a source within close proximity to his / her residence. How these sources are determined is<br />

usually linked to the size of the major settlements within each administrative area or the spatial<br />

closeness of settlements In the case of the data you will be using the nearest points to reported<br />

occurrences. These are places or settlements.<br />

The data contains numerous columns<br />

Oid_1 = Object ID (Auto Number for a spatial point)<br />

NOTIAREA = Notification area (The area which patient stated as their area of residence.)<br />

NOTIDISTMA = Notified Magisterial District<br />

SUMOF99_ to 08_ = The total sum of cases in each year falling within the NOTIAREA<br />

CORR_LOC_N = Corrected location<br />

LATITUDE = latitude of the place of residence<br />

LONGITUDE = longitude of the place of residence<br />

CODE = Code corresponding to the malaria area<br />

MAL_AREA = The name of the Malaria area<br />

POP01 = Population in 2001<br />

HOMESTEADS = The number of homesteads in the Malaria area<br />

POP05 = the population extracted from the Census data in 2005. Data was extracted based on the<br />

location of the residence point falling within a Census area.<br />

QGIS for Malaria Page 57


It is vital to understand what each field means.<br />

Incidence vs Prevalence<br />

Incidence and prevalence are different statistical measures of disease occurrence. They are often<br />

confused. This section shows you how to calculate both Incidence and prevalence.<br />

Incidence<br />

Incidence is refered to as the risk of becoming ill over a period of time. It measures the chance of being<br />

infected within an area over an extended period of time. It therefore includes time as a measure. So if<br />

we look at the small rural community of Monzi In Northern KwaZulu-Natal the Incidence rate will be the<br />

total number of infections added divided by the Total average population divided by the number of<br />

years of records.<br />

Open the Layer malaria_case-Health_facility. Open the attribute table. You need to find the record for<br />

“Monzi” So type”Monzi” into the “Look for box and select NOTIAREA from the drop down filed selector<br />

and click on Search<br />

You will notice that at the top of the window it notifies you One matching feature is found (1 Matching<br />

features)<br />

To See this record tick the Show selected only box This will show the Monzi Record. This shows only the<br />

requested record. We will use this to calculate both incidence and prevalence.<br />

The following is a simplified method of calculating Incidence.<br />

Incidence needs to take into account how many years the infected individuals contributed to the total<br />

infected population. So to get incidence one multiplies the number of infected by the length of time<br />

they have been infected within the total population So if you look at the data<br />

QGIS for Malaria Page 58


1999 (which was year 1 of the 10 year study) = 57 people<br />

=57 x 10 = 570 person years<br />

2000 = 15 =15 x 9 = 135 person years etc<br />

This is done for each year. At the end of the study 250 people were not infected (340 – 90) = 250 x 10 =<br />

2500 person years Add all these person years together to get the influence of all affected individuals per<br />

year<br />

=570+135+40+28+6+5+12+4+0+2= 802 person years<br />

Add the cumulative infected total person years to the total uninfected years =2500<br />

=802+2500=3302 person years.<br />

The incidence rate is the total number of infected divided by the total cumulative person years in the<br />

sample or study = 90/3302 = 0.027256 new cases of malaria per year per person<br />

In other words Incidence rate is 27 anticipated new cases per thousand people each year.<br />

It therefore shows anticipated risk of infection.<br />

Prevalence<br />

Prevalence is a lot simpler and is referred to as the total number of cases of malaria within the entire<br />

population of an area at a given point in time or over the entire period. It is the number of affected<br />

divided by the total population.<br />

So in 1999 the prevalence was 57/340 = 16.7% which is extremely high! Over 3 people in 20 had malaria.<br />

However we want to know what the average prevalence is over all years as prevalence varies with time<br />

due to availability of breeding sites etc.<br />

To work it out you need to add all the cases together and divide it by the total population<br />

The total number of cases is therefore 57+15+5+4+1+1+3+2+0+2= 90<br />

The average total population over this period is 340 the field Pop05 (Population from 2005)<br />

So if we look at the Monzi example:<br />

Total Prevalence of malaria within the population over the 10 year period is (90/340) x 100 =26.5%<br />

QGIS for Malaria Page 59


This tells you how wide spread Malaria is within your population. Unlike the common cold which is<br />

transitory in nature, Some strains of Malaria can recur within an infected individual and therefore once<br />

infected the infected numbers can be considered cumulative.<br />

Now you will calculate the prevalence for all Malaria case locations reported. You will do this by creating<br />

a new field in your table and updating it using the field calculator<br />

Make sure your malaria_case-Health_facility.shp file is in the legend. Open the attribute table and<br />

toggle editing on. Within the Window the icon to “New column”<br />

becomes active.<br />

Add a field called “prevalence”, Make the data type decimal<br />

Number (real), the width3 and the Precision 2 (this sets the with<br />

of the column at 3 and allows for 1 decimal place. You can add a<br />

comment To tell users what the column means (prevalence<br />

figures for Malaria 1999 – 2008) Click on OK. You will find the<br />

column at the end of the table<br />

Now you will update this<br />

column.<br />

Open the Field calculator<br />

using the field calculator icon. This opens the filed<br />

calculator.<br />

Within the field calculator you will have to<br />

construct a mathematical formula using the<br />

existing columns to calculate prevalence (This will<br />

be the sum of all infections per year e.g.<br />

SUMOF1999_ divided by the total population<br />

multiplied by 100 to get a percentage)<br />

You will be updating an existing field namely the<br />

column (field) “Prevalence” that you just dreated<br />

The formula to use is shown below and can be<br />

constructed by double clicking on each field and<br />

using the operators to add each one to the Expression.<br />

((SUMOF1999_ + SUMOF2000_ + SUMOF2001_ + SUMOF2002_ + SUMOF2003_ +<br />

SUMOF2004_ + SUMOF2005_ + SUMOF2006_ + SUMOF2007_ +<br />

SUMOF2008_)/POP05)*100<br />

Once complete Toggle editing off and Save changes and you will see a column<br />

QGIS for Malaria Page 60


updated with percentages of prevalence.<br />

Now that the prevalence data is available within your attribute table you can map the prevalence using<br />

thematic mapping.<br />

Open the Layer properties window for malaria_case-Health_facility<br />

Go to the Syle Tab and change the style from single symbol to graduated. Use the column Prevalence<br />

Change the symbol size from 2 to 3. Choose the OrRd colour ramp palette. Ensure you have 5 classes<br />

and change your Mode to Natural breaks (Jenks)<br />

Then click on th Classifybutton to<br />

add the palette to the Style<br />

window You should see the<br />

following:<br />

Click on OK and you will see the<br />

relative prevalence of Malaria<br />

with Red indicating High<br />

prevalence and Pale Orange as<br />

low prevalence.<br />

table with 0 prevalence. However this will<br />

prelude possible identification of future<br />

prevalence’s for removed records. You can<br />

also remove 0 or the lowest class from the<br />

prevalence classes.<br />

In most instances you will not be<br />

interested in 0 prevalence and<br />

will only want to show high<br />

prevalence. There are a number<br />

of ways to achieve this. The first<br />

is to remove all records from the<br />

Challenge: see if you can undertake this<br />

Remove the 0 -3 class.<br />

This thematic method is a quick and easy<br />

way of identifying areas with high<br />

prevalences.<br />

If you want to examine just the number of<br />

cases per year regardless of the number of<br />

people present in the sample area you can<br />

select the year of interest and perform a<br />

QGIS for Malaria Page 61


graduated display of them.<br />

Undertake a graduated Jenks 5 class thematic classification of the 1999 malaria figures.<br />

What differences can you see between this and the previous classification<br />

Interpolation<br />

QGIS has the option of interpolating to a<br />

raster surface from a series of points. It offers<br />

2 options (TIN) Triangular Irregular Network<br />

which uses a series of triangles to link points.<br />

And (IDW) Inverse Distance Weighting which<br />

uses the principle that influence of a point<br />

decreases as you move away from it.<br />

You will undertake a IDW interpolation.<br />

First you will load the KZN boundary file. Right<br />

click on the KZN layer and Zoom to Extents<br />

(This will ensure that the Interpolation covers<br />

a large enough area.<br />

Next you will open the interpolation tool from<br />

within the Plugins Drop Down menu.<br />

This opens the interpolation Plugin window.<br />

Change your input layer to:<br />

malaria_case-Health_facility<br />

Select Prevalence as your interpolation Attribute And add it to the Input layer by selecting Add<br />

Change the Interpolation method to IDW<br />

QGIS for Malaria Page 62


Click on Set to current extent<br />

Leave the other options as default<br />

Save the output file as Prevalence.<br />

This will result in a rater layer being generated. You will initially see it as a standard grey rectangle.<br />

To View the interpolation open the properties window for prevalence and change the Color map to<br />

Pseudocolor. Turn on standard deviation and set it to 2 and Click ok<br />

QGIS for Malaria Page 63


You will see an image which is primarily<br />

blue- green but with a concentration<br />

of red in the north east corner. What<br />

interpolation does is tries to<br />

extrapolate data to areas that does not<br />

have any data. It is a model and not<br />

always accurate but it allows you to see<br />

patterns in data. You can now make<br />

KZN hollow and place the boundaries<br />

on top of the Prevalence layer.<br />

General Information<br />

http://www.malaria.org.za/Malaria_Risk/General_Information/general_information.html<br />

QGIS for Malaria Page 64


<strong>Practical</strong> 8 Summary <strong>Practical</strong><br />

Outline<br />

Introduction<br />

Determining load on Health Facilities<br />

Buffer<br />

Voronoi<br />

Determine which points do not have access to Health facilities<br />

Determining which points are at risk using Water bodies<br />

Determining areas of need based on Prevalence<br />

Determine points with limited access<br />

Determine where to Place Interventions<br />

Introduction<br />

This practical is designed to get the user to try and identify where the greatest need is for control<br />

programs or health facilities to combat Malaria and the effects of malaria. It is assumed that you are<br />

now proficient with QGIS. Instructions will therefore be simplistic in an attempt to challenge you.<br />

The data has been projected into a meters projection so you can undertake buffer operations. (Hint:<br />

When undertaking selections create sub-selections with which to work)<br />

You will be working in the Municipality that shows overall Highest Malaria prevalence in KZN from 1999<br />

to 2008 “Umhlabuyalingana”.<br />

You have at your disposal<br />

Roads<br />

Rivers<br />

Malaria cases<br />

Health facilities<br />

Determine load on Health Facilities<br />

Buffer<br />

QGIS for Malaria Page 65


Use the health facilities layer and buffer this by 10 km. (Buffer)<br />

This buffer indicates the travel distance cut off to a clinic.<br />

Use this buffer to sum the number of people within reach of the clinic. This gives you an idea of load on<br />

facility (Join Attributes by location)<br />

Voronoi<br />

Undertake a voronoi using the health facilities.<br />

Work out the number of people each Health facility needs to Accommodate based on straight line<br />

distance. (Join Attributes by location)<br />

Determine malaria points without access to Facilities<br />

Use the Health facilities buffer to select the malaria cases which are not within reach of a health facility.<br />

(points in polygon + Invert selection)<br />

Determine Points at Risk<br />

Mosquitoes need water to breed. Therefore select all remaining points within 500m of a river. (Buffer<br />

and points within polygon)<br />

Determine Prevalence<br />

Map the points thematically to see which have the4 highest prevalence<br />

Limited Access<br />

We return to the issue of accessibility. We are looking at targeting interventions where it is most<br />

needed. If a malaria point is in excess of 500m from a road, they have a more difficult time accessing<br />

health facilities and travel. Therefore any of the remaining points outside 500m of a road is a target.<br />

(Buffer, Point in polygon)<br />

Determine what you think is the most needy Area in terms of aid.<br />

Which points are left Based on prevalence where which point/s should you target with aid<br />

Extra input<br />

Buffer the Malaria layer with the 2005 Population. Those areas that have overlapping Buffers have a<br />

potentially higher population. Does this impact on your decision<br />

Undertake an interpolation to see if you can verify your Choice visually<br />

QGIS for Malaria Page 66

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!