IMPORTANT UPDATE! See
here
.
Bill came
, he saw, but he did not conquer. When election day rolled around, Barack Obama stomped Hillary Clinton in Humboldt County, 53-38.
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.
All told, it looks like Democrats in the more conservative and/or poorer areas of the county generally went with Clinton. Above is Fortuna, a Clinton Island adrift in a sea of Obamania. Rio Dell also went strong for Hillary.
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?
Download the Google Earth .kmz file
if you want to play with it yourself.
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.
This article appears in Parting the Redwood Curtain.

Very cool. Thanks for sharing.
Interesting visual analysis.
Does it mean anything?
Well, it’s data. I noted a couple of the things I found interesting. You’re welcome to find your own.
you’re using linux on your daytime pc to do gis?
interesting…
the data too…
Hell yes! ArcView is for weenies.
I like the visual presentation. Is Google ok with this use of Google Earth? I invite Hank to check out my art blog.
Claire: Google adores this use of Google Earth.
But now that I look a little more closely I see that there’s a bit of an offset between the overlay and the actual precinct lines. Zoom in on Eureka. You can see that the lines are off kilter from the streets by a half-block or so both on both the east-west and north-south axis. Not enough to affect the presentation substantially but enough to irritate.
I assume this is because the county’s data is a bit imprecise. Either that or the shapefile didn’t reproject well. Now that I think on it, I realize this happened when I was dinking with the data last year, too.
Hell yes! ArcView is for weenies.
Then shell out the dough for ArcGIS, install a little free thing called KMLer and pretend to be a pro. That way you could actually have all of your coordinates in the same projection, instead of having your lines all over the place.
And why are you only doing pseudo-analysis of the Democrats anyhow?
Spoken like a true ESRI user!
The coordinates are all “in the same projection,” ya goofball. You don’t have a layer with polygons in different projections.
The question is whether the county’s data is one decimal point too imprecise — entirely possible — or whether the skew is due to a weakness in GDAL. Also possible.
Maybe I’ll call and hassle Chinmaya, see what he thinks. I’ll throw your multiple-projection theory at him too, if you like.
Why only Democrats? Because it was more interesting.
The county usually has their stuff in NAD27.
So you are transforming the shapes into WGS84 datum before making it a KML?
Exactly. Like I said in my Technical Note.
EPSG:4236, to be totally precise.
Then you may want to try EPSG:4326
ya goofball…
Oh my holy God Jesus you are right.
How utterly embarrassing.
Check out the contents of my .prj file for a good laugh. You earned it.
Bring back D_Hu_Tzu_Shan!
So where does Hillary go from here? How much will PA and the rest of the primaries mean? I feel the wind being sucked out from my sails…
Lindsey: You like what I do with your data? Hire me, I’ll amaze your constituents and justify your mindblowing new salary!
Just 15 percent of the vigorish, off the top.