Maps are a powerful data visualization tool that allow us to examine spatial patterns that may not be apparent when viewing the same data in a table or chart. They also allow layering of information, revealing relationships between multiple and otherwise disparate data sources.

3.3.1 Objectives

You will need the files for Section_3_3 to complete this module.

One indicator used to measure program performance is the number of patients newly enrolled on pre-antiretroviral therapy (pre-ART). In this exercise, we will work with ART data to prepare a map comparing program performance with prevalence.

3.3.2 Summarizing program data

The program data needed for this exercise is in Excel and was collected at health facilities for the period October–November 2014. We will use Excel pivot tables to summarize this data by district for use in QGIS.

  1. Open Microsoft Excel and open the file HIV_ART_Oct_Nov_2014.xlsx in your exercise data folder.
    Step 1
  2. This file contains data on ART at health facilities.
  3. On the Excel main menu, click on Insert and select Pivot Table; click OK.
    Step 3
  4. We would like to summarize the data by district, so our row labels would be district names. On the PivotTable Field List select District and drag it to the Row Labels.
  5. Our column headings will be the Total No of ART cases and New Pre-ART cases. Select No_ART and New_ART and drag them to the Values section.
  6. Your table should resemble the graphic below.
    Step 6
  7. By default, the pivot table has given us a count of cases. However, we would like to know the sum of cases per district. To do this, click on Count of No_ART in the values box and select Value Field Settings. Change the calculation type to Sum, and do the same for Sum of New_ART.
    Step 7
  8. When done, save your file under the same name in the MyExercises folder.

3.3.3 Save results of pivot table

  1. Highlight the pivot table results and copy and paste into a new Excel workbook. Use the paste as values option.
    Step 9
  2. Next, edit the column headings of the table. Edit the column heading for the first column to District, the second column to No_ART, and the last to New_ART.
  3. Delete the Grand total row. You should now have a 3 column spreadsheet like the one below.
    Steps 10-11
  4. Save your file as HIV_ART_District_OctNov2014.xlsx in the MyExercises folder.

3.3.4 Convert Excel file to .csv

To import Excel data into QGIS, it must be converted into a comma separated values file (.csv or comma delimited text file).

  1. Click on File > Save As. Change the Save as type from Excel Workbook to CSV by clicking on the down arrow and selecting CSV.
  2. Save the file as HIV_ART_District_OctNov2014.csv in the MyExercises folder.
  3. Click Yes on the next dialog box.
  4. Close the file and exit Excel.

3.3.5 Load CSV file in QGIS

  1. Launch QGIS and click on the Open button Open button on the main menu.
  2. Browse to your exercise files folder and open Exercise_3c.
  3. This project consists of a layer of district-level HIV prevalence.
  4. Click on Layer on the main menu.
  5. Click on Add Layer, then select Add Delimited Text Layer.
    Steps 20-21
  6. In the dialog box that opens, Browse to MyExercises and select the CSV file that you just saved: HIV_ART_District_OctNov2014.csv.
  7. For File format select CSV and for Geometry definition select No geometry (attribute only table).
  8. Click OK.
    Steps 22-24
  9. The CSV file has been added to your layer panel.
    Step 25
  10. Right-click HIV_ART_District_OctNov2014 and open the attribute table to familiarize yourself with the data.
  11. Close the attribute table.

3.3.6 Join .csv file to districts

In order to map the ART data, we have to link it to district boundaries.

  1. Open the Join attribute table tool in the Processing Toolbox.
    Step 28
  2. Make the following selections in the Join attributes table window:
    • Input layer: RWA_Districts_ANC_HIV;
    • Input layer 2: HIV_ART_District_OctNov2014;
    • Table field: district;
    • Table field 2: District.
  3. For your Output layer, save the file in the MyExercises folder as Districts_ART_Oct_Nov2014.shp.
  4. Click on Run to run the tool.
    Steps 29-30
  5. Your layer has been added to your map document as Output layer.
    Step 32
  6. Open the Output layer attribute table, scroll right, and scroll through the data. The Output layer now consists of both HIV prevalence data and ART data.
    Step 33
  7. Close the attribute table.
  8. Save your map as Exercise_3c.qgs in the MyExercises folder.

3.3.7 Create a map of multiple indicators

As mentioned in the introduction, this exercise is intended to map program performance by mapping the number of patients newly enrolled on pre-ART and comparing that to prevalence. This will require preparing a map of multiple indicators. One way of accomplishing this is to display one variable as a choropleth map and the second variable as a chart or diagram. In this exercise, we will display pre-ART cases using proportional symbols.

Proportional symbols portray point data to show the relative magnitude of a particular variable. The norm is to display the symbols at the center of the area they depict—in this case, the district. To do this, we must create polygon centroids from the Output layer. A centroid is a geometric center of a polygon.

3.3.8 Create polygon centroids

  1. On the main menu, go to Vector > Geometry Tools > Polygon Centroids.
    Step 36
  2. In the dialog box, browse to the MyExercises/Data folder and save the file as ART_Centroids.shp.
    Step 37
  3. Click OK in the next dialog box and then close the box.
  4. Your layer is added to your map.
  5. Right-click on the Districts layer and click Remove. We do not need it for our exercise.
  6. Your map should resemble the graphic below.
    Step 41: Visual Cmparison

3.3.9 Create a choropleth map showing HIV prevalence by district

  1. Double-click on the Output layer to open the Layer Properties dialog box.
  2. Under Style, change from Single Symbol to Graduated.
  3. Select PREV as your Column field.
  4. Select Reds as your Color ramp and click Classify.
    Steps 43-45

Note how your map looks now.Step 45

3.3.10 Symbolize data using proportional symbols

  1. Symbolize the ART centroids using proportional symbols.
  2. Double-click the ART_Centroids layer to open the Layer Properties dialog box.
  3. In the left panel, select Diagrams.
  4. Select the Display diagrams button.
  5. In the Diagram type box, use the pull-down menu to select Text diagram.
  6. Click on the Background color pull-down menu and select a yellow color.
    Steps 48-51
  7. Click on the Size tab and check the Scaled size option (previos versions: un-check the Fixed size option).
  8. Select your scale attribute. In the Attribute pull-down menu, select New_ART as the attribute to map using proportional symbols.
  9. Click on the Find maximum value button and change the size to 9.
    Steps 52-54
  10. Click on the Position tab and select Over Point from the Placement pull-down menu.
    Step 55
  11. Click on the Attributes option, select New_ARTin the attributes list and click the green plus sign to add it to the assigned attributes. Change the color to a dark color like black. This will label the proportional symbols with the value from the data.
  12. Click OK when done.
    Steps 56-57
  13. The ART centroids layer you used for the proportional symbols is a set of points. These points are separate from and independent of the diagrams you are superimposing on them as proportional symbols. As a consequence, you might sometimes see two sets of symbols on your map when you only want one.
  14. To avoid this problem, double-click on the ART_centroids layer again and select Style on the left panel.
  15. Set the Size of the symbol to zero and click OK.
    Steps 59-60
  16. Your map should look like the graphic below.
    Step 61: Visual Comparison
  17. To change the font properties of the proportional symbols labels, double-click on the ART_Centroids to open the properties.
  18. Click on Diagrams, then on the Appearance tab. Next, click on the Font button to change the font style.
    Step 63
  19. Study your map—it should be very interesting. In some districts where prevalence is high, there are fewer new patients on pre-ART than in districts where prevalence is low. This could be attributed to various factors. By visualizing our data on a map, we can see emerging trends and seek necessary interventions.
  20. Save your project in your exercises folder (Save As).

Top