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...
Geocoding the Addresses
Import the geopy python module and geocode the latitude and longitude of all the addresses as follow:-
We should have an updated csv file that will contain latitude and longitude values for each of the addresses.
Obviously, the geocoding did not return results for all the addresses, so we have to manually update the missing results.
Mapping the Addresses
Create a google map and import the updated csv file that contains the latitude and longitude of all the INEC State Office addresses.
Google maps is one of the easiest map you can quickly create to visualize these addresses. If you know any other method of making such a map, be free to use it.
The Map
That is it!
Thanks for following.
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...
Geocoding the Addresses
Import the geopy python module and geocode the latitude and longitude of all the addresses as follow:-
from geopy.geocoders import Nominatim
nom = Nominatim()
address = pd.read_csv('INEC_Office_Addresses.csv')
full_address = (address['Address'])
add_list = []
for add in full_address:
# for add in address:
print ('Processing .... ', add)
try:
n = nom.geocode(add, timeout=10)
data = (n.latitude, n.longitude, n.address, add)
add_list.append(data)
except Exception:
data = ("None", "None", "None", add)
add_list.append(data)
We should have an updated csv file that will contain latitude and longitude values for each of the addresses.
Obviously, the geocoding did not return results for all the addresses, so we have to manually update the missing results.
Mapping the Addresses
Create a google map and import the updated csv file that contains the latitude and longitude of all the INEC State Office addresses.
Google maps is one of the easiest map you can quickly create to visualize these addresses. If you know any other method of making such a map, be free to use it.
The Map
That is it!
Thanks for following.
Thanks for sharing... I appreciate
ReplyDeleteThis is particularly interesting for me. As a GeoSpatial Enthusiast and A pupil Town Planner. Being trying to Create Something similar to yours. Well done Umar. Looking Forward to interact with you in person.
ReplyDelete