## Monday, March 19, 2018

### Geolocating INEC State Offices

Hello there,
Counting from today (19th of March, 2018), Nigeria: General Elections 2019 (Time until Saturday, 16 February 2019) is less than 360 days away.

In this post, I will share with you how you can Geocode and Map INEC State Offices. The final product will be useful for finding direction to the INEC State Offices using Google map navigation system.

The Data

The dataset is a CSV file that contains list of addresses of INEC State Offices. This list has no geographical information (as seen below), so I will be converting the address into geographical location in form of latitude and longitude (a process know as geocoding) after which I will map the addresses on an interactive map. With this map, you can find you direction to any of the addresses of INEC State Offices by panning and zooming around the map.

The Tools

I will use a python module to geocode the addresses and then use Google maps to map the addresses.

Let's get started...

## Wednesday, March 14, 2018

### Convert OpenStreetMap of Abuja in Raster to Vector map

Hello there,
In this post, I will demo how to easily download the vector map of the city center of Abuja, Nigeria. We will be converting and OpenStreetMap Raster map to Vector map suing QGIS and related plugins.

Steps to follow...

Step 1:
From QGIS menu go to Web >> OpenLayers plugin >> OpenStreetMap >> OpenStreetMap

On the dialog box that opened, specify the extent and select where to save the .OSM file, then click on OK to run the process. This will download all points, line and polygon feature with the area selected.

Step 3: Load the .osm file into QGIS just as you will load any other vector file. The result is as seen below....

That is it!

Note: Another useful plugin to get information from OSM is the OSMInfo plugin.

## Thursday, March 8, 2018

### An Interactive Map of Nigeria showing State Governors

Hello there,

Here I present to you an Interactive Map of Nigeria that showcase the states and their Governors in picture (we can add more states' attribute if we want to).

Just point your mouse over any state to reveal the name of the state, the governor's name, the governor's picture etc.

The following interactive map presents a visualization of Nigeria's state governors. Governors are elected for a term of four years (maximum of two terms). A person shall be eligible for the office of Governor if he or she is a citizen of Nigeria by birth, at least 35 years of age, is a member of a political party and is sponsored by that political party. The constitution limits state governors to only two four-year terms in office.

Happy viewing....

Do you like the map you saw above? Would you like to have a similar map made for you? Give me a call or send me an email: +2348039508010 or umaryusuf49@gmail.com

## Tuesday, March 6, 2018

### Distance Between Two Geographic Coordinates (Latitude and Longitude)

Using python to compute distance between two latitude and longitude points

Latitude and Longitude coordinates assume the earth is sphere in shape (i.e NOT flat). So, since the earth is a sphere, you can't use the distance formula that works for two points in a plane. Instead you will use a formular that approximates and assumes the earth is a sphere or ellipsoid namely:-
1- Vincenty formula
2- Haversine formula
3- Great-circle distance
4- Spherical Law of Cosines formula for distance calculations

Here are some Python based Geographic Coordinates distance calculations using Haversine formula and Vincenty formula.

First lets see how to calculate the distance between two point on a flat plane using the distance formula
Distance=(x2x1)2+(y2y1)2

In python it should look like this...

def distance(x1, y1, x2, y2):
dist = ((x1 - x2)**2 + (y1-y2)**2)**.5
return dist

x1, y1, x2, y2 = 3.52, 7.02, 10.55, 9.60

print (distance(x1, y1, x2, y2)) # Result is 7.49meters

## Friday, March 2, 2018

### QGIS Multipart to Singleparts

Here we have an administrative polygon layer with series of Islands as seen below...

Now, we don't want the Islands to be part of the main polygon, so we have to split them apart. Thanks to the "Multipart to Singleparts" command tool under the "Vector >> Geometry Tools" menu. This command takes a vector layer with multipart geometries and generates a new one in which all geometries contain a single part. Features with multipart geometries are divided in as many different features as parts the geometry contain, and the same attributes are used for each of them.