I have a “real” assignment (for work as opposed to study) to do some data visualizations using maps. It’s been a journey of over a week to get to the place where I’m ready to start, and the journey has had some educational detours along the way that I thought I’d share.
Naturally, because I’m learning Python, my first thought was “obviously I’m going to use Python to do this assignment” so I googled Python libraries and the top hit was Basemap. I spent an afternoon on the couch working through Roger Veciana i Rovira’s most comprehensive tutorial on the topic, I learned about shape files and discovered that South Africa has a Municipal Demarcation Board, from whence I downloaded some shapefiles for our country, and then the Western Cape province. It was pretty satisfying to see my map of South Africa drawn in front of my eyes, and I could definitely see several applications that might be useful in future… But this wasn’t quite the map I was looking for – I wanted something prettier onto which I could superimpose my scatterplot type data. The type of maps you see on Google, for example…
More searching led me to the strong impression that there are more libraries out there than one thinks! GeoPandas looks pretty interesting and I’d like to check it out one day…
Then it was suggested to me that Tableau would be the solution, and the promise of license availability enticed me enough to download the trial version – yoh! This application is like the Excel of visualizations – drag and drop, easy import. I had a map with data drawn onto it within 30 minutes. No coding required! But there were 2 “buts”: 1) I was kinda disappointed not to have achieved my objective in Python and 2) the license turned out to be out of validity so I couldn’t carry on using it anyway!
Anyway the more I thought about it, the more I realized that if I want a Google map there should be no reason why I can’t use Google API to go get me one! (Except for the part where I’ve never worked with API’s… trepidation…). Luckily, I had some basic orientation to what they’re about thanks to a recent project I worked on where other developers were using them as part of the solution – so at least I knew that you send a message over yonder, and get a response back. And this turned out to be enough to get started (!), with the help of Google documentation and this fine tutorial by Vik Paruchuri on dataquest.io.
So this morning I’m doing air punches because I have a map, fetched from Google, and I can finally start my data visualization – phew!
If you’d like some input on coding this I’ve included my How it works – Google Static Maps API.
PS The bounding box tool is VERY useful for co-ordinate orientation – it’s probably a bit of a hack for now but in the interests of time I’m going to use it to set co-ordinates on my axes…