Friday, August 10, 2018

Getting Google Maps API key in 2018

If you are an old developer who uses the Google Cloud Platform Console developer's tools such Google Maps API key to power application, you will notice that getting a copy of the maps API key has slightly changed in the month of July, year 2018.

Unlike in previous years, when signing up for a copy of the key is just a matter of having a Google account and then putting up a simple request. Today, Google do request for credit card information before the sign-up process is completed. So, the big question now is: Is there no more FREE quota for the Google Maps API key anymore?

Creating a Google Maps API Key
Even though, Google now requests for your credit card information before the sign-up for a key there is still the free quota usage on the API key as usual. Google says: the reason why it request for the credit card information before the sign-up, is to make sure bots/robots don't sign-up for the keys. Also, there is no auto charge on your card when you use up the free trial/quota on your key.

Before you are charged, you will have to manually upgrade your key to a paid plan.

Saturday, July 28, 2018

How to Extract Accurate Point Coordinates and Heights from Google Earth

In this post, we will use free software to extract height/elevation/altitude of points above sea level for any location in the world from DEM (digital elevation model) databases. This is fairly good data for drawing contour maps, draw a profile of a track or to colorize points by height above sea level.

The sources of the elevation data is from a DEM (digital elevation model) databases as explained below:-

DEM data sources
USGS: NED The U.S. Geological Survey's excellent National Elevation Dataset covers the United States, Canada, and Mexico. 1 arc-second (~30-meter) horizontal resolution is available in most areas (NED1). For Alaska, 60-meter data is also available (NED2). 
NASA: SRTM1 NASA's SRTM1 database (from the Space Shuttle Radar Topography Mission) has a resolution of about 30 meters. Previously, SRTM1 data was only available for the United States (and was not very useful because NED1 is generally better), but recently NASA has released SRTM1 tiles for the entire world. GPS Visualizer's server does not contain the full global dataset, but it does contain all of Europe, Japan, South Korea, and Taiwan, as well as parts of Australia, New Zealand, and South Africa. Additional locations will be installed upon request. 
ASTER: The ASTER GDEM is a joint product of NASA and the Japanese Ministry of Economy, Trade, and Industry (METI). ASTER has very good 30-meter coverage of the entire world, but the awkward download process and the massive size of the database make it impractical to store all of it on ASTER files for Iceland are available, however, since none of the other 30-meter databases cover that area. (As with SRTM1 data, additional files can be added upon request.) 
NASA: SRTM3 NASA's SRTM3 dataset includes 90-meter resolution for the entire world.

Monday, July 23, 2018

GIS Base map with Web Map Service (WMS)

Web Map Service (WMS) is a convenient way for an organization to publish or share spatial datasets online that can be readily used in GIS. WMS is a popular standard for publishing maps on the internet.

WMS is hosted on a remote server. Similar to a website, you can access it as long as you have a connection to the server. WMS is a standard protocol that serves geo-referenced map images using data from a GIS database.

With WMS you have access to a live service that will automatically refresh its view if you pan or zoom on the map. So, you always have access to the latest and upto date published data.

WMS are perfectly use as background maps for GIS project. It can be used on web, mobile and desktop GIS applications. All you need is the WMS getURL (GetMap or GetCapabilities) from any of the organizations that publish or share spatial datasets online.

Some WMS organizations are:-
1~ USGS:
2~ Boundless Geo:
3~ Mundialis:
4~ Terrestris:
5~ Geofabrik:
6~ The Hug:
7~ Omniscale:
8~ WhereGroup:
9~ Sinica:

Friday, July 20, 2018

Difference between GeoJSON and TopoJSON

In the Geospatial industry, data handling and conversion is a vital skill especially when data are been moved from on platform to another.

Some data formats work better on one platform than another. For example, data in shapefile format are more flexible on desktop apps than on web apps. If you are looking for an excellent data format to use on the web, then "GeoJSON and TopoJSON" data formats are your best option. But what is the difference between "GeoJSON and TopoJSON"?

In this post, I will attempt to differentiate the two powerful web based geospatial data formats (GeoJSON and TopoJSON).

GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes. Both GeoJSON and TopoJSON are based on JSON, the JavaScript Object Notation.

As extracts from Noah Veltman of and Mike Bostock (and other contributors to the TopoJSON extension) repectively:-

GeoJSON and TopoJSON are two web-friendly file formats for geographic data.
A GeoJSON file is a text file with a list of features and, for each one, a bunch of latitudes and longitudes describing its geometry.
A TopoJSON file is similar, but instead of storing the latitudes and longitudes directly, it describes the topology (geometrical properties and spatial relations of figures) of a group of features, meaning the borders between them. TopoJSON files are usually much smaller, but require a little bit of extra processing in the browser when you want to display one on a map, and can potentially lose details from the original latitudes/longitudes.

TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs. TopoJSON eliminates redundancy, offering much more compact representations of geometry than with GeoJSON; typical TopoJSON files are 80% smaller than their GeoJSON equivalents. In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and cartograms.

The advantage of TopoJSON over GeoJSON is size and encoding of topology. So, if the file size or topology of feature is paramount to you, use TopoJSON instead of GeoJSON.

Monday, July 16, 2018

Map of 2018 Ekiti State Gubernatorial Election Final Result

The much anticipated 2018 Ekiti state gubernatorial election has come to pass and 24 hours after the result has been announced by INEC, Nigeria social and news medias are flooded with the result.

Unfortunately, non has analysed the result on a map. In this post, I will related the result to map of Ekiti state so we can see the spatial relationship in the result.

Ekiti state has 16 local governments and 177 electoral wards.

Thursday, July 12, 2018

Geo-visualization of FIFA 2018 World Cup

As stated on Wikipedia page: The 2018 FIFA World Cup is the 21st FIFA World Cup, a quadrennial international football tournament contested by the men's national teams of the member associations of FIFA. It is currently ongoing in Russia starting from 14 June and will end with the final match on 15 July 2018.

In this post, I will attempt to visualize the participants on a world map starting from qualifying countries, group stage, round of 16, quarter finals, semi finals etc.

Let's get started....

Saturday, July 7, 2018

Python and Data Science Blogs

The list below are some of my favorite blogs I have followed and gained alot of from over the years. I hope you will also like them.

Some useful blogs for python and data science enthusiasts:-
















Wednesday, July 4, 2018

Geo-spatial Professional Areas of Interests

The Geospatial industry is quite a vast industry that encompasses many areas of interest. In this article, I will briefly take a look at the most common areas.

As someone who works in the Geospatial industry, you will find yourself doing one or more combinations of this areas of interests:-

Tuesday, June 12, 2018

Modern Map of Ancient Kano City Gates (Kofa)

Kano City Gates - Kofofin Garin Kano

The amazing structure (the ancient walls of Kano city, Nigeria) was built during the reign of King Kijimazu (Sarki Gijimasu) between 1095 through 1134 and completed in the middle of the 14th century. They are ancient defensive walls built to protect the inhabitants of the ancient city of Kano and were described as "'the most impressive monument in West Africa".

Below is a copy of a Map produce in 2004 by 'Geography Dept, Bayero University, Kano (BUK)' showing the accient Wall and Gates.

The ancient wall is a 14km radius earth structure that surrounds the Dala Hills, Kurmi Market and Emir's Palace located in the heart of the modern day city of Kano as seen as the darkest spot on the map below.

The Ancient Kano City Walls originally had an estimated height of 30 to 50ft and about 40ft thick at the base with 15 gates (kofa) around it.

The names of the gates are:-
1~ Kofar Kansakali
2~ Kofar Kabuga
3~ Kofar Gadonkaya
4~ Kofar Dukawuya
5~ Kofar Waika/Adama
6~ Kofar Wambai
7~ Kofar Mazugal
8~ Kofar Mata
9~ Kofar Nassrawa
10~ Kofar Dan Agundi
11~ Kofar Na'isa
12~ Kofar Ruwa
13~ Kofar Fampo
14~ Sabuwar Kofa
15~ Kofar Dawanau

In todays modern Kano city, the gates are all that is left. Ninety percent of the walls have since disappeared, they are either gone or crumbling, very soon there will be nothing left of it and history of the walls would be erased completely.

Most of the gates have been rehabilitated and rebuild by the past Kano state government.

Adeyemi and Bappah coducted field survey in 2010 and obtained the following "Summary of Wall Measurements and Observations" below as published in their research paper.

Source: Conservation of Kano Ancient City Wall and Gates: Problems and Prospects in Nigeria, (2010)

Saturday, June 9, 2018

Street-level Map of Nigeria Cities

Most at time it is almost impossible to find an updated and editable version of Nigeria city map at street-level that shows details such: Buildings, Landuse, Natural features, Places, Places of worships, Railways, Roads/Streets, Traffic, Transport stations, Waterways etc.

Such detailed maps are great for many task including for city planning. In this post, I present to you a street-level map data at scale for all major cities in the country.

Lagos City, Lagos (State) - Badagry, Epe, Ikeja, Ikorodu, Lagos, Mushin, Shomolu

Eastern Cities, Enugu (State) - Enugu, Nsukka | Anambra (State) - Awka, Onitsha | Imo (State) - Owerri | Abia (State) - Aba, Arochukwu, Umuahia

Friday, June 8, 2018

Unable to parse KML file in python 3 with PyKML module


Recently, I picked up a project where I had to read/parse in a point KML file and do reverse geocoding on the latitudes and longitudes coordinates of the points. So, I found a nice python module that will help me accomplish this. But I found out that it doesn't work fine on python 3 installation but works great on python 2.

When I import pyKML as follow "from pykml import parser" in python3, it returns the error as thus: ModuleNotFoundError: No module named 'urllib2'

I knew the pyKML module was trying to work with 'urllib2' module which has changed in python3. Since python2 will soon be discontinued, I have to find a solution for it to work on python3.

Ok, just in case you don't know pyKML, according to the documentation, pyKML is a Python package for creating, parsing, manipulating, and validating KML documents/files. A KML is language for encoding and annotating geographic data used by Google Earth, Google Maps and a number of other GIS platforms.

Tuesday, May 29, 2018

Find the Elevation of any Location

According to WikiPedia: the elevation of a geographic location is its height above or below a fixed reference point, most commonly a reference geoid, a mathematical model of the Earth's sea level as an equipotential gravitational surface.

In the geo-spatial industry, getting and working with the elevations of points is a very common task for many obvious reasons. Elevation value of points can be obtained through various techniques such as land surveying and GPS observations.

Using the techniques above, there will be a challenge when you need to obtain the points that are difficult to access. In such situations, you will have to consider a remote service to get such elevation values. One of such remote services that provide access to elevation data we will discuss in this blog post is:

Tuesday, May 22, 2018

Jupyter Notebook Python user input() function

Jupyter notebook has added a feature I have always wished it had long ago. Before now, writing a script that accepts input from user with the input() function in python3 or raw_ input() function in python2 was almost impossible and you have to switch between the terminal window and the jupyter notebook all the time.

The newer version of jupyter notebook has made available a text-box right inside the browser whenever you call the input() function as seen below;-

Enjoy the new GUI feature of the jupyter notebook.

Wednesday, April 11, 2018

Scrape data from Google maps

Scrapping data from Google maps made by third party

Often, you will find Google maps published by someone you don't have access to and you really want to extract some data from the map.

Lets consider this map below, assuming it was published by someone you don't know and you have to have access to the raw data behind the map.

When you click on individual features on the map, the required data of that point is displayed on the left side panel. Now, the task is to extract or collect those data for every point feature on the map into a spreadsheet for further use/consumption.

Step to extract the data

Here is how to go about extracting such dataset.

Step 1: On the main page, click on the three vertical dots to expand the menu

Step 2: Select "Download KML" to download a file that can be read by Google Earth software, text editor and other GIS software.

Step 3: Open this downloaded KML file in any software of your choice to access the data contained there in. In my case, I used QGIS to open the kml file and exported the content into a CSV/Excel spreadsheet.

That is it!
Now if you come across any Google maps that you want to access the data used in preparing the map, that is how to go about accessing it. Enjoy!

Sunday, April 8, 2018

GPS coordinates of INEC Offices across the country

Find GPS coordinates of INEC Offices in Nigeria

Few days ago, I wrote on finding addresses of INEC states' offices. I even showed the locations of each INEC state headquarters on Google maps.

On this post, you will find list of Latitude and Longitude GPS coordinates of INEC offices across the country. There is at least on major office in each state of the federation, here is the list below:-

INEC Abia Hqtr, Umuahia
INEC Adamawa Hqtr, Jimeta
INEC Akwa-Ibom Hqtr, Calabar
INEC Anambara Hqtr, Awka
INEC Bauchi Hqtr, Bauchi
INEC Benue Hqtr, Makurdi
INEC Borno Hqtr, Maiduguri
INEC Bayelsa Hqtr, Yenagoa
INEC Cross-River Hqtr, Calabar
INEC Delta Hqtr, Asaba
INEC Ebonyi Hqtr, Abakaliki
INEC Edo Hqtr, Benin City
INEC Ekiti Hqtr, Ekiti
INEC Enugu Hqtr, Enugu
INEC Nigeria Hqtr, Abuja
INEC Gombe Hqtr, Gombe
INEC Imo Hqtr, Owerri
INEC Jigawa Hqtr, Dutse
INEC Kebbi Hqtr, Birnin Kebbi
INEC Kaduna Hqtr, Kaduna
INEC Kogi Hqtr, Lokoja
INEC Kano Hqtr, Kano
INEC Katsina Hqtr, Katsina
INEC Kwara Hqtr, Ilorin
INEC Lagos Hqtr, Lagos
INEC Niger Hqtr, Minna
INEC Nasarawa Hqtr, Lafia
INEC Ondo Hqtr, Alagbaka
INEC Ogun Hqtr, Abeokuta
INEC Osun Hqtr, Osogbo
INEC Oyo Hqtr, Ibadan
INEC Plateau Hqtr, Jos
INEC Rivers Hqtr, Port Harcourt
INEC Sokoto Hqtr, Sokoto
INEC Taraba Hqtr, Jalingo
INEC Yobe Hqtr, Damaturu
INEC Zamfara Hqtr, Gusau

If you find any inconsistent or missing data, please let me know to correct immediately at: umaryusuf49 (at)

Thank you for following.

Friday, April 6, 2018

How to setup MySQL Database on

Hello there, is one of the platforms that allows you to easily host scripts written in python. In this post, I will show how to setup a database server on the platform and load in data from a simple python script.

There are several databases supported on the platform. the common once are:-
1- SQLite (a server less database that requires not setup at all)
2- MySQL (a server based database available for free account holders)
3- PostgreSQL (a server based database available for paid account holders)

I will be using the MySQL database for this demonstration as it is the one that requires setup and is available to every on account (free and paid accounts).

Step 1:
If you haven't already, create a free account on

Step 2:
Login to your account dashboard and go to the "Databases" tab. Then Create a database by specifying the Database name and MySQL password

Step 3:
After creating a Database name and MySQL password, you should have a MySQL Console added to you list of consoles under the console tab. The name will look like this: MySQL: username$dbname

Open it and you should have your MySQL console running just like mine...

Step 4:
Now, you can enter MySQL commands to interact with your MySQL database via the console. For example, lets display the databases and tables in our account by entering: show databases; and show tables;

Step 5:
To create a table, enter this query....
CREATE TABLE test_table (
id int,
member_id int,
status varchar(255)
The above query creates a new table named "test_table" with three fields namely; 'id', 'member_id' and 'status'. The 'id' and 'member_id' fields are integer fields while 'status' is a varchar.

Connecting your app/script:
To connect your web application or any python .py script to the database, you simply
For example if you are using the MySQLdb module, you connection will look like this:-
conn = MySQLdb.connect(

That is it!
You have learned how to create a MySQL database on PythonAnyWhere.

Note: To create another database, just repeat step 2 above. Also, note that whatever database name and password you specified at that point are the credentials you will use if you a connecting to the database from an external script such as python .py script.

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.

Simply download and install QGIS with the following plugins: OpenStreetMap Downloader and OpenLayer plugins

Steps to follow...

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

When the OpenStreetMap layer finished loading, zoom to Abuja metropolis or any area you want to download its vector map.

Step 2: Next, go to: Vector >> OpenStreetMap >> Download Data

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

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

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