Crowdsourcing request: swing district locator

October 23, 2012 by Sam Wang

I want to create a tool to help locate swing Congressional districts (CDs) near you. Can you help?

I’ve identified the districts – now I need a way to display them conveniently. The ideal tool would be a compact app that uses a ZIP code to return the nearest three swing CDs, along with links to resources such as and campaigns (both D and R). For example, in California the swing districts are CA-07, 09, 10, 24, 26, 41, and 52. These are places where Get-Out-The-Vote (GOTV) activity would be most effective – for either side.

Original map from the California Citizens Redistricting Commission

The swing districts are listed after the jump. Write me directly (left sidebar, About Us).

Update for the very knowledgeable: in one solution, the key missing piece of information is GIS-friendly Congressional district boundaries. If you have those…swoon!

Pacific Coast states



South, including Texas

New England



Francis Goldwyn says:

First, go to wordpress and post the request there – lots of people with great app development experience –
Second, take a look at:
I am not an expert here – but you are on to something potentially big – if you can get some programming help you may get a deep inside view of the election.
I will send out some notes to a few people who might be able to help.

Zach C says:

I really like this idea of yours. I am curious how you identified the districts though.

Sam Wang says:

Francis Goldwyn says:

I have posted what you are looking for in the Word Press forums – hopefully someone will reach out to you.
You might also try posting your request on:
Lots of independent developers there many with extensive experience.
Hope this helps.

Terence Heinel says:

Stackoverflow is a great site but it is mainly for people looking for answers to programming questions. This topic will most likely not get much of a positive reception there but you might find someone that can point you to usable GIS-friendly Congressional district boundary data.

Michael Worley says:

If you are planning something for election night, I would enjoy having 1 map that had House, senate, president, and ballot measure result tabs. Governor too I suppose.

Sam Wang says:

I will not be providing returns here. I will see if I can find a link to the best information source.

JamesInCA says:

How “fantsy” do you want it to be?
My first thought was some geocoded thing that would take your current location and find the actual nearest district.
But that list isn’t terribly long, and if I stick to the state I’m in (or nearby states if I’m near a border, or live in a small state), it’s really a pretty short list.
In other words, for the purpose of this election, do you need anything other than a map with the key districts shaded? Or maybe a national map with each state containing one or more key districts shaded, which when clicked gives you the state map with key districts shaded.
Longer-term, it would be interesting to have a more generalizable tool for directed action that would be location-aware, and could be loaded with data for different issues. Once you have the general framework in place, you could apply the same logic to state legislature elections, etc., anything where you have enough data to identify tipping-point jurisdictions.

Sam Wang says:

Brute force, but could do. If need be I’ll do it…

JamesInCA says:

Google has made the 2012 congressional district boundaries available here:
Someone with good Google Maps API knowledge can probably take the list of districts from your post and have them shaded inside of ten minutes. Sadly, though, that person isn’t me.

Sam Wang says:

This sounds very promising.

Ralph says:

You want some of the GIS software. I found some Google maps tools when I was interested. Search on Google Maps Mashup…something similar to what you want is out there.
KML (Keystone Markup Language) is pretty easy to use.
I ended up using a commercial package. But this free one is pretty good:

Sam Wang says:

I have access to GIS. The difficulty is 2012 Congrerssional districts. Do you know where to find them?

Brian says: has decent mashups going between Google Maps and 2012 US congressional districts. He might be of some help. His name is Josh.

Terence Heinel says:

A haven’t found the specific data needed yet but must have it because they can generate an accurate map of my 2012 district which underwent changes recently. They have a very liberal policy regarding use of their data and it can all be downloaded from here… I will update if I can find the district boundaries.

Olav Grinde says:

Could this be done based simply on the numerical proximity of zip codes? Assuming that geographic proximity correlates with that… And if each swing district is broken down into a sub-list of zip codes..

Olav Grinde says:

One complicating factor: Apparently some zip codes span more than one Congressional District.

Sam Wang says:

Not the point. ZIP code tells approximate location, which can then be mapped in a Euclidean manner to CD centroid. That is good enough for GOTV planning.
This can also be done with a series of maps, but that is tedious and not as useful.

JamesInCA says:

ZIP codes do not correspond well to congressional districts, or much of anything else, really. They’re not actually defined as geographic areas, but as lists of addresses organized for grouping mail carriers.

Sam Wang says:

They are better than other identifiers of location. For example, in California they would tell whether one was closer to Sacramento or Riverside.

JamesInCA says:

Sure, it just depends how much precision you need. I use ZIP code centroids to plot the number of customers within 5, 10, 20 miles etc. of our location, and I don’t mind if I’m a little off. Likewise Riverside vs. Sacramento. But I’d guess with congressional districts, particularly in an area like Los Angeles, for example, there’d be too much fuzziness around CD and ZIP code boundaries. It’s a question of resolution.

Scav says:

Would the National atlas work? They say they have the distrivt boundaries for The 112th congres. So long as you have a current set of decent centroigd for ZIPs, do a point on poly for the inside ones, then a nearest and then its basically just a lookup table.

Sam Wang says:

Yes, but see the price tag. Recall that this is a hobby for me.

Phil says:

I think this may help you:!topic/fusion-tables-users-group/CZCfGd6hfKk
You’ll need to then use a program like geocommons to put data into the shapefile

Adam says:

How I’ve always done this is the past is by using shapefiles, as mentioned above, and the maptools package in R. Lots of programmatic ways to color maps, but this package is worth looking in to:

Adam says:

Unfortunately Sam I can only find shapefiles for the 111th district and earlier:

Nat says:
Will have shapefiles for congressional districts.
It looks like they also have zip code areas. zip centroid -> district centroid.
Google is building some address to political geography matching tools:

Sam Wang says:

Obviously a list of such centroids would be a good first approximation. However, I believe the Census site only lists old CDs. What is needed here is current CDs!

Jay Bryant says:

I have a friend who is an app wizard and politically inclined. I sent her a link to this topic. I’m also a software developer and have written apps, though I mostly work between the database and the app. Let’s see what happens. 🙂

Mark Eirich says:

2012 CDs in Adobe Illustrator format:

Sam Wang says:

And only $600. In some eyes that is not a bad price…but it doesn’t even give coordinates.

dwgsp says:

Maybe these folks would let you use their database in exchange for some free publicity…

LDE says:

Dr. Wang,
Here is a quick and dirty plot out of the NE swing districts made using R and the rgdal package.
And the R code to do it, containing the link to the data source for the district boundaries (I can’t vouch for the quality of that).
Something like this might be built on fairly readily. I imagine python would work well for this also, but don’t really know it.
I work at the same place, so could chat further with you about this easily, if it’s of any use.

Sam Wang says:

OMG. Pending checking the data source…Jackpot!
Now, ZIP codes and a python guru…

Ms. Jay Sheckley says:

Sir, perhaps you just found what you need, but don’t forget you have committed friends. My er budget is such that when I feel something is important enough to give to, I find that others are similarly seriously inclined. You provide a service of great importance.
As this is a creative endeavor, Indie GoGo could work. My bookstores can offer material prizes to contributors, and will ship them. I often don’t notice email, so have someone facebook message me if I should check email:

538 Refugee says:

How about making the map to give them the co-ordinates to the nearest relevant office? No point worrying about what the district looks like, just worry about getting them to the people that can use them? I’m sure the campaign staffs would be happy to give up the office addresses by district.
PS, I just tried to clean the little smiley off at the bottom of the page thinking it was dirt…. 😉

Joe says:

Dr. Wang,
I’m a very experienced software developer and would be happy to help implement a solution as a public service. Please email me at the email address I left in this comment if your are interested.

Jason Berlin says:

Hello Joe! I’d love to know if you ever did this! I’m launching an organization to register Democratic voters in nearby swing districts across the country, and could absolutely use this tool! Thanks so much!

Michael D says:

National Atlas has the 112th congressional boundaries in shapefile form. Does anyone have the 113th congress boundaries in a shapefile or geodatabase? Google maps don’t help, they just put districts on a road map but can’t do analysis. We’re going to find the closest district with a GIS.

Leave a Reply

Your email address will not be published. Required fields are marked *