U.S. National Parks Map with Google Chart Tools

I wanted to give Google Chart Tools a try, since they'd be really useful for throwing together a quick graph for a webpage. I picked the geochart to try first and decided to plot the U.S. National Parks on a map, with the markers scaled and colored by park size. It was quite simple to throw together. Mouse over the dots for the park name and year it was founded. Brief technical notes follow.

Technical Notes

First I needed the coordinates of all National Parks, which was available on Wikipedia, naturally. It was simple to scrape the year founded and acerage from that page. Under the external links, I found you could click to see a "map of all coordinates from Google." The URL looked like this:

which becomes

Turns out that Wikipedia's ToolServer has a kmlexport feature. Pages with coordinates can be exported as KML files. More info on the tool can be found here. It means that a KML of all the National Park coordinates can be downloaded from:


(Technically, it's a KMZ, which can be easily unzipped if you change the extension to .zip.) I parsed the KML file with a Perl script that used XML::TreeBuilder and incorporated the year and acre data that I copied directly from the Wikipedia page. It spit out the data in a JavaScript array format: [lat, long, acres, 'park name (year)'].

[44.35, -68.21, 47389.67, 'Acadia (1919)'], 
[-14.25, -170.68, 9000.00, 'American Samoa (1988)'], 
[38.68, -109.57, 76518.98, 'Arches (1971)'], 
[43.75, -102.5, 242755.94, 'Badlands (1978)'], 

You can download all data files and scripts used, in a compressed folder. To easily see the JavaScript and HTML used to render the map, travel to this page and view source.