Tools for generating choropleth maps
Perl
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
USA_Counties_with_FIPS_and_names.svg
random.png
random.svg
state.png
state.svg
trans.pl

README.md

Perl Choropleth

Choropleth maps are those geographical maps where different regions/counties are colored differently, like election results, etc.

The super easy way to generate them is to take SVG and transform it. This little script does exactly that, in perl.

It requires XML::Parser, which you might be able to install by doing yum install perl-XML-Parser. If that works, you win.

The script trans.pl parses an SVG source file and modifies colors. It's currently set up to use this awesome public domain map of the USA. I made a few modifications to the source map to fix some bugs:

  • Worth, NO -> Worth, MO
  • Polk, WIO -> Polk, WI
  • Yukon-Koyukuk, AL -> Yukon-Koyukuk, AK

There are some example outputs along with the code to generate them.

Colors come from ColorBrewer, which you should use too.