Create a Targeted Areas layer¶
This procedure is for the GIS or data staff who prepare the Targeted Areas of a door-to-door (house-to-house) campaign, such as a polio vaccination round. It shows, step by step, how to build the layer with QGIS from open data, and how to prepare the settlement layer that gives the results by settlement.
What GTS needs¶
The Targeted Areas are the areas that a team is expected to visit. GTS counts an area as visited when a team recorded valid GPS points inside it (see Door-to-door campaigns). For a door-to-door campaign, they are usually settlements. Large settlements are divided into grid cells, for example of 100 x 100 meters: without a grid, a single GPS point in a town would mark the whole town as visited, whereas the grid shows which share of the town was covered.
The layers uploaded to GTS must follow these rules (full description in Inputs, Administrator guide):
Item |
Requirement |
|---|---|
File |
One ESRI shapefile per |
Shapes |
Polygons. Point layers are refused for Targeted Areas. |
Coordinate system |
Any usual coordinate system, as long as the |
Unique ID |
Optional. A field with a different value for each area, kept from one round to the next for time-trend analysis. |
Label |
Optional. A field with the name displayed on the map, used by the search and in the exports. |
Numeric fields |
Values stored in a numeric field (integer or decimal), such as the estimated population. They can be used as custom indicators. |
Text fields with few values |
Fields with fewer than 6 different values, such as the settlement type (BUA, SSA, HA). They can be used to group the indicators. |
|
Optional whole number: the minimum time a team must spend in the area, used instead of the general Minimum duration. It is currently read as seconds (1800 for 30 minutes). |
Field names |
10 characters at most (shapefile limit): longer names are cut when the file is saved. |
Note
GTS treats a Targeted Areas layer as a grid when its shapes are mostly simple rectangles or when it has more than 100,000 areas. The results of a grid are not exported area by area (see Geocoverage indicators and Targeted Areas). To get the results by settlement, upload the settlements as a base layer and use it as the smallest aggregation level (steps 8 and 9).
Example used in this procedure¶
The example prepares the Targeted Areas of a polio vaccination campaign in Nigeria, Lagos State, Badagry LGA, in the Ajido and Iworo-Gbanko wards. Polio campaigns target children under 5 years of age. The same method applies to other countries and target groups, with the data available for them.
Caution
Do not confuse the areas targeted by the campaign with the areas targeted for GTS tracking. The latter are usually a sub-set of the former, depending on the number of phones available to follow the teams.
Before you start¶
Install QGIS 3.28 or later (a Long Term Release is recommended) from https://qgis.org. The screenshots were taken with QGIS 3.28: menus and windows may look slightly different in later versions.
You need basic GIS knowledge and an Internet connection to download the data.
Each processing tool of QGIS creates a temporary layer, which is lost when QGIS is closed. Save every result as a file: either choose Save to File… in the output field of the tool before clicking Run, or right-click the temporary layer afterwards and click Make Permanent. In both cases, choose the ESRI Shapefile format and the file name given in the step, then rename the layer the same way (right-click > Rename Layer).
Overview¶
Download the data: settlement extents, boundaries and population estimates.
Add the data to QGIS.
Assemble the settlements targeted for GTS tracking.
Divide the settlements into grid cells.
Add the target population to the grid cells.
Fine-tune the Targeted Areas layer.
Export the Targeted Areas layer.
Export the settlement layer.
Upload the layers to GTS.
Step 1 - Download the data¶
Settlement extents and boundaries¶
In this example, the settlement extents are of three types: Built-up Areas (BUA, towns), Small Settlement Areas (SSA, villages) and Hamlet Areas (HA, groups of a few households). They are available, with the boundaries, on GeoPoDe:
On the GeoPoDe home page, select Nigeria (direct link: https://nga.geopode.world/).
Point to the Geometry menu and choose Custom export.
In States, select Lagos.
In LGAs, click Undo All, then select Badagry.
In Layers, select LGA Boundaries, Ward Boundaries, Built-up Areas, Small Settlement Areas and Hamlet Areas.
In Export Format, select ESRI Shapefile.
At the bottom of the page, enter your e-mail address and click Request Export.
Custom export of GeoPoDe: Badagry LGA, five layers, ESRI Shapefile format¶
A few minutes later, you receive an e-mail with a link to download a ZIP file with the data.
Target population estimates¶
To estimate the target population (children under 5), download the WorldPop gridded population estimates, a
raster (.tif file) with a resolution of about 100 meters:
Go to https://wopr.worldpop.org.
Select the filters Population, NGA (Nigeria) and v2.0 (1 in the figure).
Click Download next to Bottom-up gridded population estimates (~100m) for specific age-sex groups (2 in the figure).
In the Information Regarding Usage window, click Agree & Download.
WorldPop repository: filters (1) and download of the age-sex groups (2)¶
Caution
The ZIP file is large (more than 1 GB) and contains many population estimates. Only
NGA_population_v2_0_agesex_under5.tif is used here, but the website does not offer it alone.
Note
GeoPoDe and WorldPop are external websites: their pages may have changed since these screenshots were taken.
Step 2 - Add the data to QGIS¶
Add the shapefiles¶
Caution
Unzip the downloaded files first.
Click Layer > Add Layer > Add Vector Layer….
Next to Vector Dataset(s), click …, browse to the unzipped folder and select the LGA shapefile (
GEOPODE_GEOMETRY_EXPORT\boundary_lgas_export\boundary_lgas_export.shp). Click Open, then Add.Repeat for the wards, built-up areas, small settlement areas and hamlet areas (
boundary_wards_export.shp,fe_builtuparea_export.shp,fe_smlsettlementareas_export.shpandfe_hamletareas_export.shp).Click Close.
The map shows the five layers (the colors may differ). The LGA layer is hidden under the ward layer.
Add the population raster¶
Click Layer > Add Layer > Add Raster Layer….
Next to Raster Dataset(s), click … and select the under-5 population estimates (
NGA_population_v2_0_agesex/NGA_population_v2_0_agesex_under5.tif). Click Open, Add, then Close.
The raster covers the whole of Nigeria.
Rename the layers¶
In the Layers panel, right-click each layer, click Rename Layer and rename it:
boundary_lgas_exporttostep1-lga;boundary_wards_exporttostep1-wards;fe_builtuparea_exporttostep1-bua;fe_smlsettlementareas_exporttostep1-ssa;fe_hamletareas_exporttostep1-ha;NGA_population_v2_0_agesex_under5tostep1-raster-pop_under5.
Set the project coordinate system¶
The size of the grid cells is entered in the unit of the coordinate system, so the project needs a coordinate system in meters.
Click Project > Properties… and open CRS.
In Filter, type
3857and select WGS 84 / Pseudo-Mercator (EPSG:3857).Click OK.
Note
By default, QGIS takes the coordinate system of the first layer added, so set the project coordinate system after adding the layers.
WGS 84 / Pseudo-Mercator is suitable near the equator. Far from it, distances are enlarged (by about 6 % at 20° of latitude): use the UTM zone of the area instead, for example WGS 84 / UTM zone 31N (EPSG:32631) for Lagos.
Step 3 - Assemble the settlements targeted for GTS tracking¶
Keep only the wards where GTS is used¶
In this example, GTS is used in 2 of the 20 wards of Badagry LGA: Ajido and Iworo-Gbanko. Delete the other wards:
In the Layers panel, uncheck all the layers except step1-wards.
Right-click step1-wards and click Open Attribute Table.
Click Select features using an expression
.
Type
"WardName" IN ('Ajido', 'Iworo-Gbanko'), click Select features, then Close. The 2 wards are selected.
Click Invert selection
: the 18 other wards are now selected.
Click Toggle editing mode
, then Delete selected features
.Click Toggle editing mode again and save the changes. The layer now contains only the 2 wards.
Add the settlement type¶
The settlement type lets GTS show the coverage by type (BUA, SSA, HA) in addition to the overall coverage.
In the Layers panel, right-click step1-bua and click Open Attribute Table.
Click Open field calculator
.
Check Create a new field and set:
Output field name:
Sett_Type;Output field type: Text (string);
Expression:
'BUA', with the single quotes (the preview shows ‘BUA’).
Click OK, then click Toggle editing mode
and save the changes.
Repeat for step1-ssa with
'SSA'and for step1-ha with'HA'.
Merge the three settlement layers¶
Click Vector > Data Management Tools > Merge Vector Layers….
Next to Input layers, click …, check step1-bua, step1-ha and step1-ssa, and click OK.
Click Run, then Close.
Save the result (temporary layer Merged) as
step3-merged-settlement-extents.
Note
If you close QGIS while temporary layers are open, QGIS asks you to confirm that their content will be lost.
Tip
Processing large layers can take time. A spatial index makes it faster: click Vector > Data Management Tools > Create Spatial Index…, select the layer in Input layer and click Run.
Keep the settlements inside the selected wards¶
Click Vector > Geoprocessing Tools > Intersection….
Set Input layer to step3-merged-settlement-extents and Overlay layer to step1-wards.
Click Run, then Close.
Save the result (Intersection) as
step3-settlement-in-wards.
Settlements that cross a ward boundary are cut in two, so that each part belongs to one ward. This layer is also used in step 8 to prepare the settlement base layer.
Step 4 - Divide the settlements into grid cells¶
Create the grid¶
Click Vector > Research Tools > Create Grid….
Set Grid type to Rectangle (Polygon).
In Grid extent, click the button at the right of the field, choose Calculate from Layer and select step3-settlement-in-wards.
Set Horizontal spacing and Vertical spacing to
100(meters).Set Grid CRS to the project coordinate system (EPSG:3857 in this example).
Click Run, then Close, and save the result (Grid) as
step4-grid.
A 100-meter cell matches the resolution of the population raster. Smaller cells give a finer view of large towns but increase the number of Targeted Areas.
Keep the grid cells inside the settlements¶
Click Vector > Geoprocessing Tools > Intersection….
Set Input layer to step3-settlement-in-wards and Overlay layer to step4-grid.
Click Run, then Close.
Save the result (Intersection) as
step4-gridded-targeted-settlements.
Each grid cell is cut along the outline of its settlement and keeps the fields of the settlement and of the ward, including Sett_Type.
Tip
To use a different cell size for each settlement type, for example 50 meters for built-up areas, 100 meters for small settlement areas and 150 meters for hamlet areas:
Create one grid per size, as above.
In step3-settlement-in-wards, select the settlements of one type with an expression such as
"Sett_Type" = 'BUA', and run the intersection with the matching grid with Selected features only checked.Repeat for each type, then merge the three results with Merge Vector Layers into
step4-gridded-targeted-settlements.
Step 5 - Add the target population to the grid cells¶
Click Processing > Toolbox, search for zonal statistics and double-click Zonal statistics (Raster analysis group). If the toolbox is not visible, click View > Panels > Processing Toolbox.
Set:
Input layer: step4-gridded-targeted-settlements;
Raster layer: step1-raster-pop_under5;
Output column prefix:
pop_under5_;Statistics to calculate: click … and keep only Sum.
Click Run, then Close.
Save the result (Zonal Statistics) as
step5-gridded-targeted-settlements-with-pop-estimates.
To check the result, select the layer, click Identify Features
and click a grid
cell. The Identify Results panel shows the estimated number of children under 5 in the cell.
Note
The new field is named pop_under5_sum. Once saved as a shapefile, it becomes pop_under5, because
shapefile field names are limited to 10 characters. Use the name shown in the attribute table in the next
steps.
Step 6 - Fine-tune the Targeted Areas layer¶
The following changes are made in the attribute table of step5-gridded-targeted-settlements-with-pop-estimates (right-click the layer > Open Attribute Table).
Caution
Before creating a field, make sure that no feature is selected: otherwise the new field is only filled for the selected features. To clear the selection, click Deselect Features from All Layers in the toolbar.
Round the population estimates¶
Click Open field calculator
.Check Create a new field and set:
Output field name:
Est_pop_u5;Output field type: Decimal number (real);
Precision:
1;Expression:
round("pop_under5", 1).
Click OK.
Remove the grid cells with almost no target population¶
Click Select/filter features using form
.Next to Est_pop_u5, type
0.5and choose Less than (<) instead of Equal to (=).
Scroll down and click Select Features.
Click Toggle editing mode
if needed, then Delete selected features
.
Keep only the useful fields¶
The fields of the layer are offered as labels and indicators in GTS: keep only the useful ones.
Click Toggle editing mode
if needed, then Delete field
.Select all the fields except the following ones, then click OK:
the settlement name, if the settlement layers have one;
WardName;
Sett_Type;
Est_pop_u5.
Add a unique ID¶
Click Open field calculator
.Check Create a new field and set Output field name to
ID, Output field type to Integer (32 bit) and Expression to@row_number.Click OK.
Click Toggle editing mode
and save the changes.
If the same Targeted Areas are used in the next rounds, upload the same file again so that the IDs do not change.
Step 7 - Export the Targeted Areas layer¶
In the Layers panel, right-click step5-gridded-targeted-settlements-with-pop-estimates and click Export > Save Features As….
Set Format to ESRI Shapefile.
Next to File name, click …, choose a folder and type
Final_TA-Polio-NGA_Under5.Keep the coordinate system of the layer (GTS reads it from the
.prjfile) and click OK.In the folder, select the files
Final_TA-Polio-NGA_Under5with the extensions.cpg,.dbf,.prj,.shpand.shx, and compress them into one ZIP file, for exampleFinal_TA-Polio-NGA_Under5.zip. A.qmdfile may also have been created: it is not needed.
Step 8 - Export the settlement layer¶
To get the coverage by settlement, for example for the missed settlement list, the settlements must be uploaded as a base layer and used as the smallest aggregation level of the Targeted Areas.
Open the attribute table of step3-settlement-in-wards.
Add a unique ID: in the field calculator, create the field
ID(Integer (32 bit)) with the expression@row_number.If the settlements have no name, create one: field
Name, Text (string), Output field length50, with an expression such as"WardName" || ' ' || "Sett_Type" || ' ' || @row_number(for example Ajido BUA 12).Save the changes, export the layer as in step 7 (file name
Final_Settlements-NGA) and compress its files into one ZIP file.
If the LGA and ward boundaries are not yet in GTS, export step1-lga and step1-wards the same way.
Step 9 - Upload the layers to GTS¶
A Focal Point uploads the layers in the administration of GTS. The screens are described in the Administrator guide: Base Layers tab and Targeted Areas tab.
Upload the base layers (LGA, wards and settlements) in a Base Layers tab, and select their Unique ID and Label (for the settlements:
IDandName).In the Targeted Areas tab of the Tracking Round, upload
Final_TA-Polio-NGA_Under5.zip, enter a Name, selectIDas Unique ID and, if available, the settlement name as Label. The quality report (Layer imported with issues) often lists small geometries: grid cells cut along the settlement outlines are small, which is expected.In the configuration wizard, select Door to door and set its Minimum duration. In 3. Aggregations Layers, use the base layers from the largest to the smallest: LGA, wards, then settlements.
In the Geocoverage Indicators tab, add the estimated population (
Est_pop_u5) as a custom indicator, and group the indicators bySett_Type.
After saving, check the warnings of the Targeted Areas tab. Some areas are outside the aggregation layer means that some grid cells are not inside a settlement of the base layer: they are ignored in the results.