Sunday, September 20, 2020

Recreating NCDC Covid-19 GIS Maps

Ever since the first case of Coronavirus disease (COVID-19) was announced in Nigeria on 27th of February 2020, the Nigeria Centre for Disease Control (NCDC) has in its effort to control the pandemic produced maps to document and visualize the status of the disease.

Some of these maps are part of the online 'COVID-19 Cases Tracking Dashboard' while other are included in pdf reports on 'update of COVID-19 outbreak' in Nigeria as seen below.


When you download and open one of the daily reporst, you will see the map below...



The second map is on the 'COVID-19 Cases Tracking Dashboard' web page.



The first map is a Choropleth map while the second is a Proportional Symbol map. In this article, I will reproduce these two maps. Lets get our hand dirty.

NCDC Choropleth map 

The data behind this map is available in the pdf file that contains the map. On the second page of the pdf file, you will see a table containing the map data that look like this below;

GENERAL FACT SHEET – DATA AS AT 9th SEPTEMBER 2020
Table 1: States with reported laboratory-confirmed COVID-19 cases, recoveries, deaths and days since last reported case

STATESCONFIRMED CASES DISCHARGED CASES DEATHS TOTAL
ACTIVE
CASES
DAYS
SINCE LAST
REPORTED
CASE
TOTAL NEW TOTAL NEW TOTAL NEW
Lagos 18,456 34 15,237 0 203 0 3,016 0
FCT 5,375 40 1,637 13 70 1 3,668 0
Oyo 3,209 8 1,961 0 38 0 1,210 0
Plateau 2,954 26 1,879 70 30 0 1,045 0
Edo 2,603 1 2,404 0 100 0 99 0
Kaduna 2,214 0 2,099 0 32 0 83 2
Rivers 2,195 2 2,087 12 59 1 49 0
Delta 1,780 12 1,616 13 48 0 116 0
Kano 1,728 0 1,604 0 54 0 70 2
Ogun 1,715 12 1,648 9 27 1 40 0
Ondo 1,575 9 1,485 42 33 0 57 0
Enugu 1,198 14 1,088 0 21 0 89 0
Ebonyi 1,034 4 986 0 30 0 18 0
Kwara 989 2 794 0 25 0 170 0
Katsina 819 0 457 0 24 0 338 2
Abia 816 0 712 0 8 0 96 2
Osun 803 1 756 2 17 0 30 0
Gombe 746 0 643 0 23 0 80 1
Borno 741 0 703 0 36 0 2 9
Bauchi 671 1 646 2 14 0 11 0
Imo 537 0 211 0 12 0 314 1
Benue 460 0 401 110 9 0 50 8
Nasarawa 443 2 298 0 12 0 133 0
Bayelsa 391 0 365 2 21 0 5 11
Jigawa 322 0 308 0 11 0 3 55
Ekiti 299 6 254 1 5 0 40 0
Akwa Ibom 283 0 247 0 8 0 28 1
Niger 244 0 216 0 12 0 16 5
Adamawa 230 2 180 0 15 0 35 0
Anambra 226 0 181 0 19 0 26 1
Sokoto 159 0 142 0 17 0 0 9
Kebbi 93 0 84 0 8 0 1 12
Taraba 91 0 73 0 6 0 12 2
Cross River 83 0 73 0 8 0 2 6
Zamfara 78 0 73 0 5 0 0 20
Yobe 67 0 59 0 8 0 0 41
Kogi 5 0 3 0 2 0 0 68
Total 55,632 176 43,610 276 1,070 3 10,952

States, including FCT, are arranged in descending order by number of total confirmed cases and then alphabetical order  


Now, copy this table into a spreadsheet and convert it to a CSV file. Note, you can also save it as an excel file, but here I don't want formating troubles so I will use a CSV file format.


Clean-up the data, the final result should look like this;-


Now, we will import this cleaned data into GIS software like QGIS and link it to a map of Nigeria (state level map). 

Join the shapefile map to the spreadsheet table and the result should look like below.


With this, we can visualize the spreadsheet data on the map. However, before we proceed with the mapping, there is a little problem we most fix.

By default, QGIS joined the table to the map by assuming that all the columns are of 'string' data type. That is not true in this case, so we most fix it. We will use the 'Refactor fields' tool from the processing toolbox.

So, go to the 'Processing' menu and select 'Toolbox', then search for 'Refactor fields' and use it to change the numeric fields to integer.


Complete the changes by running the 'Refactor fields' algorithm. A new updated map layer will be created. Now this is the map we will use for this visualization purpose.

Use the symbology property to create the choropleth map.



Add the state names as label and use the print layout to add other map elements such as scale, north arrow, legend as seen on the pdf sample.

That is it as seen below.


The resulting map provided here may not be 100% exactly like that of NCDC, but at least we are very close and with a little more tweaking here and there, we can make it look perfectly the same.

Lets move to the second map.


NCDC Proportional Symbol map

Here we will use the same cleaned CSV data from above and as you may have already noticed, this map use a point features layer instead of polygon.

So, we have to prepare the point layer to represent the states not polygon. We can use the centroid of the states polygon to archieve this or we can get the latitude and longitude values of the capital of each state.

Here I used the geometry functions 'x($geometry)' and 'y($geometry)' in field calculator to generate a new attribute with longitude and latitude of the centriond fro each state polygon. Then export the attribute as CSV and imported is back a point layer using the 'Add Delimited Text Layer' tool.



After import the point layer, note that I used the OpenStreetMap plugin to add a background map so that we can have something close to the NCDC map we are trying to reproduce.

After you installed the OpenStreetMap plugin, it will available under web menu as seen below.


To create the proportional symbol map, there are two way of doing it namely:-

1) Use graduated symbology and change the method to 'Size' instead of 'Color'


2) Use data override function on single symbology

To access this go to: 'Data defined override' botton the select 'Assistant...'.


Each method has is pros and cons, but at the end you will achieve same proportional symbol map as seen below;-



Note:

  • The dataset used here may not be the actual reflection of COVID-19 status in the country, it is merely for explanation sake.
  • The second map is left in static form instead of dynamic web map as seen on NCDC website. If you want to take the static map further to the web, consider using the qgis2web plugin.


At the end, I hope you got something useful out of this post.

Happy mapping!

No comments:

Post a Comment