Here is what I did:
- Found a data set containing the election data. The Virginia Department of Elections website has a CSV file with the data I needed here.
- Learned to use Python to extract the data I needed from this source. This turned out to be surprisingly easy (maybe not so surprising, that's why I love Python!). I just needed the cvs module which comes with the standard library. I then wrote a small script, precinct_winners.py, which produced a list containing the winner for each precinct.
- Wrote a script, vihstadt_howze_election_map.py, using mapnik and my precinct_winners.py script to generate a color coded map showing precincts which Howze won in green and those Vihstadt won in red.
I plan to spend the rest of my available time today trying to overlay Columbia Pike, the road along which the proposed streetcar that caused such a stir in this election had been planned to run.
I found a shapefile with all the roads in Arlington County here. I'm planning to explore this file with the pyshp rather than the GDAL module, since pyshp is pure python instead of a wrapper around a C++ library and thus will be easier to work with.
My next post will report on my results.
Post a Comment