IMPORTANT UPDATE! See
That's just a piece of the story, though. The county's final precinct results, released Thursday, showed that Hillary Clinton was strong in some areas. Where? We made a little Google Earth map to show where.
The screenshot above shows the most divided town in the county: Eureka. Hillary is green, Barack is purple. The darker the color, the bigger the margin of victory against the principal rival. (Light white represents a tie vote -- you can see an example of it at the lower left.)
Click through for more pictures, a link to download the Google Earth overlay and a technical note for readers of a geeky bent.
Also: Indian Country is Hillary Country. The square is the Hoopa Valley Reservation; the two big precincts to the northeast are dominated by the Yurok Reservation. Look at Orleans, to the right, though. Strong Obama!
One word of warning: These precincts, which are outlined in red, were consolidated in this election, as they are in most. I wasn't able to redraw the lines to take the consolidation into account. So if you see a precinct in dark green, it doesn't necessarily mean that that precinct went strong Hillary. It could mean that that precinct was wrapped up with a couple of other precincts, and taken together they all went strong Hillary. Clear?
Technical Note: This whole project would have been a hell of a lot easier if I hadn't accidentally wiped my installation of PostGIS a couple of days ago. And it ain't so easy to get back, because my dpkg bug is flaring up again, and I'm waiting for the release of Ubuntu 8.04 to reinstall the OS. Anyways, if I hadn't eliminated my totally sweet, tuned PostGIS database with a stroke of the key, I could have dealt with the consolidated precincts issue in a heartbeat. Coloring the precincts would have been a lot easier, too. And I could have put a handy-dandy little clickable placemark at the center of each precinct, so you could click and get the raw vote.
But it was not to be. So I started off by using ogr2ogr reproject the county's elections precinct shapefile to WGS84 Lat/Long so's it'd play with Google Earth. Then I went ahead and used ogr2ogr to translate the shapefile to KML. Without my database, I had to manipulate the KML directly in order to color the polygons; for this, I used the excellent lxml library.
To get at the data, I scraped the county's final precinct results , which are only available in PDF. Then I scraped the Elections Department's Polling Locations PDF news release to figure out which precincts had been consolidated into which. I dumped all this into an SQLite database using the Django ORM. This wasn't actually as hard as I expected it to be.
And that was more or less that. A little Django/lxml script brought the pieces together.