Loading ...
Sorry, an error occurred while loading the content.
 

Re: How Are The Maps Created For Govtrack.us

Expand Messages
  • tay199
    OK! Thanks for the tips. I ve been reviewing with my partner (programmer) and have had some success :) Next stop, cartograms. Thank you so much for the help!
    Message 1 of 6 , Oct 18, 2006
      OK! Thanks for the tips. I've been reviewing with my partner
      (programmer) and have had some success :)

      Next stop, cartograms.

      Thank you so much for the help!



      --- In govtrack@yahoogroups.com, "Joshua Tauberer / GovTrack.us"
      <tauberer@...> wrote:
      >
      > tay199 wrote:
      > > I'd be very interested to know how the maps for govtrack.us are
      > > created.
      > >
      > > Are the boundaries districts or zip codes? How do you plot the
      > > boundaries on the map? Are the maps pixel or vector based? Is there
      > > an open source app, or app that does this?
      >
      > The maps for votes right? (As opposed to the Google Maps widget for
      > finding your district.)
      >
      > The maps are by district (or state, for senate votes). It was not an
      > easy task, especially the new cartograms, and there wasn't (or rather, I
      > didn't use) a single app to create them.
      >
      > The maps start with the Census's cartographic data files for states and
      > congressional districts:
      >
      > http://www.census.gov/geo/www/cob/cd109.html
      >
      > With the shapefile format files from there, and the Perl module
      > Geo::ShapeFile, I can get the polygons for each state or district.
      >
      > Then I use the Perl module GD, which wraps the libgd library, to do the
      > actual drawing of each polygon into a png image, colored by vote. To
      > speed up drawing, I reduce the resolution of the polygons by removing
      > points that wouldn't show up anyway in the image.
      >
      > Actually, to draw the maps, one needs to convert the latitude/longitude
      > points to x/y coordinates. For small-scale maps you can just take lat
      > as x and long as y, but for maps covering the entire U.S., the earth's
      > curvature makes that not look so good/accurate. For that I chose the
      > Albers Equal Area Conic Projection, probably because it was the first
      > projection that I found the formulas for.
      >
      > That makes regular maps. The cartograms are a whole other story. The
      > only freely available command-line program that I found for turning
      > regular cartographic data into a cartogram (i.e. stretching polygons so
      > that regions of equal population take up an equal amount of area in the
      > image) is here:
      >
      > http://www.santafe.edu/~mgastner/
      >
      > Most cartograms distort regions by population, but I distort regions by
      > their influence in Congress. Since all districts have the same
      > influence, they are all distorted as if they all have the same
      > population of 1. To do that, I used Geo::ShapeFile again to convert the
      > shapefiles to the format the cartogram program expected. And then the
      > maps are drawn based on new coordinates outputted by the cartogram
      > program. (It sounds straight-forward, but I'm leaving out a bunch of
      > very tricky details that I won't ramble about unless you're interested
      > in it.)
      >
      > The whole thing is very messy which is why I haven't posted any source
      > code. (If you or anyone else is interested in putting together a nicely
      > packaged district-map-drawing library, I'd give you whatever I have that
      > would help.)
      >
      > --
      > - Joshua Tauberer
      >
      > http://razor.occams.info
      >
      > "Strike up the klezmer and start acting like a man. You're
      > about to have a truth-mitzvah." -- The Colbert Report
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.