Depicting Election Results

As something of a political junkie, I've always wanted to be able to make detailed maps of election results. These days, it's pretty easy to get county-level election maps for most statewide contests--but not all contests are statewide, and a county is a pretty big chunk of land, and usually not as homogenous as the county maps make them look. What I've always wanted to do was to take the basic precinct-level voting data that counties release, and turn it into a map.

There are some very nice, and very expensive tools for doing this kind of mapping, and there are companies that do very well making precinct-by-precinct maps of election results for various organizations. If you are comfortable doing some programming, you can do some very nice stuff using Google Earth. These folks did several states that way using 2004 election data.

But neither of these processes are at all easy--and even using Depiction hasn't been easy. It's very easy to load precinct shapefiles that are available from many county GIS pages into Depiction. And once it's in there, you can add properties like candidate vote percentages, and then go through and update them. The problem is that, when you have hundreds of precincts, it doesn't make sense to go through and insert votes for each of them by hand. And there hasn't been an easy way to link massive amounts of outside data to shapes in Depiction.

Until now! Our whiz-kid intern Daniel has built a fantastic Excel macro that will match vote data to precinct numbers in a GML file (the kind of file exported by Depiction). It could probably also be used for things like census data and such, but like I said, I'm a political junkie.

So I built this map using the election results from Fairfax County, Virginia, from Tuesday's gubernatorial election there.

At some point I'll write a detailed tutorial on how I did it, but here's the short version: 

  • I downloaded the precinct shapefile from the Fairfax county GIS page.
  • I got the precinct-level election results from the State of Virginia and put them into a spreadsheet (this was the hardest part, because they aren't presented very conveniently, but some creative copy/paste/filter work made it work).
  • I imported it into Depiction, then added two fields to the precinct shapes: McDonnellVote and DeedsVote.
  • Then, I exported it all to a GML file, and used the GML Data Inserter macro to insert the McDonnel percentages, and then the Deeds percentages, into the GML file.
  • Then, I imported it back into Depiction and fixed a couple errors.
  • Last, I selected all the new shapes, and used the 'thematic mapping' colorization option to shade the precincts based on their votes.

And there you have it! All in all, this probably took less than two hours to do. And the beautiful thing is, once this data is in a depiction, there's so much more you can do with it! I could add more voting data and compare the past to the present. I could bring in other juristiction shapefiles and look for useful voting patterns within them. Or, best of all, I could use the same depiction to plan the logistics of an entire campaign, with all the important vote data right there.