Saturday, February 8, 2014

Finding murders with OpenStreetMap

Since the end of the nationwide suspension of capital punishments in 1976, 1365 people have been executed in the US. Only 13 convicts were female and a majority of 87 per cent died by lethal injection. Alarming 34 per cent were black, which is around 2.5 times the number that should have been doomed according to the distribution of population. The most executions were done in Texas (509).

The Death Penalty Information Center (DPIC) offers a detailed database including all executions and necessary details to map the cruelty. After an informal mail correspondence, I received the approval to use the database for non-commercial use as long as I mention the source. Their site is not clearly giving copyright information, thus I recommend to ask for permission before you publish something derived from their data.


DPIC’s database is not providing coordinates but county names, which is why it is a good source to show how you can geocode your data when you only have place names. Nominatim is a great extension using OpenStreetMap to do geocoding or reverese geocoding. The best thing about it is that Nominatim has an API interface and thus you can do the geocoding with a script. My programming skills are very rudimentary but I had experienced assistance to develop a well working Python script for a former project. Adapting a few lines in the script, it was easy to send my county names and state names to Nominatim and get back the lat and lon values for each county’s weighted centre. There are several scripts that you can use with Nominatim or Google Maps in case you also want to avoid a lot of handwork when geocoding. You will find them online.

Using Python to geocode (input: red, output: green)


After data cleaning and saving the worksheet to a .csv file, QGIS’ Add Delimited Text Layer tool can easily import the execution data and you can save it to a point Shapefile.


Adding lat lon data to QGIS
I wanted to present the data in a catchy way so I adopted some of Anita Graser's ideas. Her blog helps a lot when learning about QGIS functions and to get some inspiration for your projects.

To make the map as patriotic as possible, you can use the new blending functions in the Print Composer and add an American flag. Anita describes how to do that in her post on making vintage maps. Moreover, I chose to also use the newly introduced Data defined properties to present each jail in relation to the number of executed convicts. Anita explains that function in her project about meteorite landings.

Data defined properties styling


Finally, we need to create a legend. Since QGIS 2.0.1, you can use HTML tags to arrange your annotations. My HTML skills are as rudimentary as my programming skills, so I only added some basic text styling.  



I don’t know much about the death penalty in the US, so I was quite surprised that there is a huge difference between the West and the East Coast. I am interested in the factors that caused this heterogeneity. The main reason should be the unequal distribution of population but there could be also historic reasons related to the colonization of the States and still persistent differences in the attitude of people or it might be just a coincidence of law regulations. I guess it is a mixture of everything. Let’s just hope that there will be more blue hatched states and less red circles in the future.

No comments: