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

How Are The Maps Created For Govtrack.us

Expand Messages
  • tay199
    Hello, 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
    Message 1 of 6 , Oct 14, 2006
    • 0 Attachment
      Hello,

      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?

      Any assistance greatly appreciated.

      Best,

      Taylor Norrish
    • Joshua Tauberer / GovTrack.us
      ... 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
      Message 2 of 6 , Oct 14, 2006
      • 0 Attachment
        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
      • John DeBruyn
        Hi Joshua: This needs to get blogged and out to the world. I checked to see that each message here even has a permalink like:
        Message 3 of 6 , Oct 14, 2006
        • 0 Attachment
          Hi Joshua:

          This needs to get blogged and out to the world. I checked to see that
          each message here even has a "permalink" like:

          http://groups.yahoo.com/group/govtrack/message/227

          for what you have just posted. OK that I look into wider distribution
          of your most recent post.

          Thanks for all that you are doing,

          John

          --- 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.
          //skip //
          > 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.
          // skip //
          > 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
          >
        • John Labovitz
          ... If you re like me and don t understand how to use these formulas, there s a wonderful library you can use to simply transform lat/lon points to x/y, in
          Message 4 of 6 , Oct 14, 2006
          • 0 Attachment
            On Oct 14, 2006, at 1:24pm, Joshua Tauberer / GovTrack.us wrote:

            > 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.

            If you're like me and don't understand how to use these formulas,
            there's a wonderful library you can use to simply transform lat/lon
            points to x/y, in dozens of projections. Originally it was called
            libproj4, but the author redid it as simply proj4. It's found here:

            http://members.verizon.net/~vze2hc4d/proj4/

            Also, if someone's looking for a C version of a shapefile library,
            this is another easy-to-use framework:

            http://shapelib.maptools.org

            --John
          • Joshua Tauberer / GovTrack.us
            ... I m not sure. I guess in my mind it sort of got replaced with the news items on the front page of GovTrack, although that ended up more about legislation
            Message 5 of 6 , Oct 15, 2006
            • 0 Attachment
              Dana Powers wrote:
              > Why no more blog posts?
              > http://www.govtrack.us/blog/

              I'm not sure. I guess in my mind it sort of got replaced with the news
              items on the front page of GovTrack, although that ended up more about
              legislation in the news than comments about the site itself.

              Not too much has been happening with the site. I've been doing some
              internal tweaks to speed things up, but other than that, there's not
              much to say.

              I've been in contact with a few others working on some related projects
              recently (one of which will be based in part on GovTrack's data set),
              and as soon as those projects go public I'll post something here.
              They'll be really great.

              And I've been playing around more with Census data lately, and finally
              today I should have more or less the whole 2000 Census converted into
              RDF. (Just for example, one could then pretty easily make a table of
              senators' votes sorted by the percentage of workers 16 years or over who
              do not work at home whose travel time to work is 45 to 59 minutes. Why
              someone would want to do that is another story, but if someone did...)

              John DeBruyn wrote:
              > This needs to get blogged and out to the world. I checked to see that
              > each message here even has a "permalink" like:
              >
              > http://groups.yahoo.com/group/govtrack/message/227
              > <http://groups.yahoo.com/group/govtrack/message/227>
              >
              > for what you have just posted. OK that I look into wider distribution
              > of your most recent post.

              Always!

              --
              - 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
            • 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 6 of 6 , Oct 18, 2006
              • 0 Attachment
                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.