Friday, September 23, 2016

Spatial Analysis of Nigeria 2015 Presidential Election Result Using QGIS


Introduction


This is the spatial version of analysis on the "2015 Nigerian Presidential Election Result using python programming language".

In this spatial analysis, I will analyze and visualize the “Presidential Election Result” dataset on a map of Nigeria showing individual states boundary. Basically that is what spatial analysis is all about.



Let’s get started…


Spatial and Non-spatial (Attribute) Datasets


Get a copy of the 2015 presidential election result from INEC website (this is the attribute dataset) and a copy of Nigeria states boundary map in shapefile format from Diva-GIS (this is the spatial dataset).

Edit the election result into a CSV file and add to columns named longitude & latitude. The longitude & latitude will contain the x-y coordinates of the centroid for each state's geometry (polygon).


Step for the Analysis


Step 1:
Open QGIS and load the shapefile of Nigeria states boundary and add the INEC Presidential Election Result dataset as a delimitated text layer.





Step 2:
Merge the attribute csv dataset to the shapefile layer as follow:-

Right click on the “states’ shapefile layer and open its “Properties” dialog box. Under “Joins” tab, click on the “+” symbol to join the layers together. For option - Join layer: select the csv layer, Join field: select the fields you want to form part of the joined data, Target field: select the state name field. Then click on “Ok” twice to apply the changes. If you now open the attribute table of the shapefile (map of Nigeria), you should see the columns originally in the csv file now part of the shapefile’s attribute.



So basically, what we did was to merge the attribute tables of the shapefile to the csv files.
There may be better ways to achieve this, feel free to use it.

Step 3:
Now let’s perform some basic spatial analysis to answer some of these questions;-

a) What is the geographical distribution of registered voters?

This can easily be answered with a hit map. From the states shapefile "Properties" box, under "Style" tab we can configure the map to display from lower to higher number of registered voters geographically. The states with higher number of registered voters are in ticker/darker color while the lighter color represent the states with lower number of registered voters.






b) What geographical region has the highest number of rejected votes?

Here, we can use the same as done above. All we have to do is change the "column: name in the  layer "Properties" box from "INEC_Number_of_Registered_Voters" to "INEC_Number_of_Rejected_Votes".





c) In what states did APC/PDP won with more than one million votes?

To answer this question, we query the attribute table based on the related columns/fields (in this case APC/PDP). The query will be like this: INEC_APC > 1000000


Looking at the attribute table, you will see the result of the query. As seen below, it only in three states (Kaduna, Kano and Katsina) that the APC party won votes above 1 million.


The result of this can also be viewed on the map as seen below (in Yellow color). That is the beauty of spatial analysis.



Let's do as above for the second best party (PDP). Let's see the geographic relation of states where PDP won more than one million votes.





You can do more with this dataset. Let's take a look a some spatial analysis with Tableau at:  Spatial Analysis of Nigeria 2015 Presidential Election Result Using Tableau - Web-based Visualization

Thank you for reading.

No comments:

Post a Comment