Re: [govtrack] Re: How Are The Maps Created For Govtrack.us
- Dana Powers wrote:
> Why no more blog posts?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 thatAlways!
> each message here even has a "permalink" like:
> for what you have just posted. OK that I look into wider distribution
> of your most recent post.
- Joshua Tauberer
"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah." -- The Colbert Report
- 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 firstname.lastname@example.org, "Joshua Tauberer / GovTrack.us"
> 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:
> 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:
> 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
> "Strike up the klezmer and start acting like a man. You're
> about to have a truth-mitzvah." -- The Colbert Report