Eye Candy

The following material only makes sense if your browser supports HTML 5 embedded video capabilities, so that you can see the video clips. To some extent all of this is simply eye candy. There's room in the world for eye candy. All of the video clips load with the playback controls hidden. Right click on the image to pull up a video menu.


Rotating a Prism Map

One problem prism maps may experience is that tall prisms near the camera obscure shorter prisms behind them. In the federal land holdings prism map, the state of Washington is completely hidden by the states in front of it. A way to address that problem is to have a video clip that rotates the three-dimensional prism map object.

The video clip to the right consists of 181 individual frames generated by cartogram.pl using the animation capabilities of POV-Ray. For each image, the camera and lightpositions are adjusted slightly. The open source program ffmpeg is used to combine those images into a video clip. As is the case with POV-Ray, only a trivial amount of ffmpeg's capabilities are used. The running time to produce the video clip was about 35 minutes.

Growing a Prism Map

Prism maps lend themselves to other sorts of eye candy. One method is to use a video clip to "grow" the prisms from a zero height to their full height. An example of that, using the prism map for western federal land holdings, is shown in the clip to the right. As in the rotation case above, POV-Ray's animation capabilities are used to produce the individual images.

Going Overboard

Just because something can be done doesn't mean it should be done.

There's a subtle difference in how the prisms in this map grow compared to the previous example. Here all prisms grow upwards at the same rate, then stop when they reach their maximum value. This video clip was constructed using an alternate process. A small bit of external code ran cartogram.pl repeatedly and copied the output file cartogram.png to a safe place after each execution. The entire Perl program is given in the following listing:

use File::Copy;

$angle = 270;
$scale = 0;
$step = 0.02;
for ($seq = 0; $seq < 181; $seq++) {
    $frame = sprintf "video/frame%03d.png", $seq;
    print STDERR "$frame\n";
    $temp = sprintf "%.2f", $scale;
    $string  = "perl cartogram.pl -type prism -data federal_land_holdings/holdings.data ";
    $string .= "-map state_outlines/48.map ";
    $string .= "-zoom 55 -ypoint 100 -thick 0.75 ";
    $string .= "-width 800 -height 800 ";
    $string .= "-camera 1200,$angle,45 ";
    $string .= sprintf "-transform \'\(\$value > \$max_value * %.2f) ? \$max_value * %.2f : \$value\'", $scale, $scale;
    system "$string >/dev/null 2>/dev/null";
    copy("cartogram.png", $frame) || die "copy failed: $!";
    $angle += 2;
    $scale += $step;
    if ($scale < 0 or $scale > 1) {
        $step = -$step;
        $scale += $step;
    }
}

system "ffmpeg -i frame%03d.png -pix_fmt yuv420p -vf scale=600:-1 cartogram.mp4";


Morphing a Contiguous Cartogram

Hugely distorted contiguous cartograms make it very difficult to recognize the underlying flat map. The obvious way around that problem is to include images of both the flat map and the cartogram. For the web, an alternative is a small video clip showing a transformation of the flat map into the cartogram. Cartogram.pl includes (quite) limited capabilities for making such a clip. An example is shown to the right. It's important not to mistake this video clip as showing anything temporal, eg, population growth over decades. It's just a fancier transition from one view to another, much like PowerPoint doing any number of silly dissolves to get from one slide to the next.

Cartogram.pl generates the video by keeping lists of the polygons from both the flat map and the cartogram. 101 images are generated by taking weighted averages of the pairs of polygons. Putting this capability into cartogram.pl rather than using external code to run the calculations was necessary to get things to change smoothly.

The example is based on a county-level map of the ten US states that encompass the Great Plains. The Plains counties are in white. There is considerable debate about exactly what area the term "Great Plains" covers [1]. While the western edge is pretty clearly defined – the Plains stop at the Rocky Mountains – the eastern edge is more controversial.

The set of counties I use is derived from Wilson's paper on Great Plains population dynamics [2], which in turn is derived from Trimble's geology work [3]. I removed the counties from Colorado's Front Range and Texas's hill country that Wilson had included. Both of those areas have experienced huge population growth that is not Plains-related, and don't match the narrative I'm usually trying to tell.

Settlement of the Plains has been called the largest agricultural miscalculation [PDF] in American history. The population of the Great Plains has been declining since 1930. The cartogram – the end point of the video clip – resizes the counties based on their 2010 population. The population of the Plains counties is so low compared to the cities just to the east and west that it's not possible to recognize the underlying map. Watching the transition from the flat map to the cartogram demonstrates just how extreme the population differences are. In that sense, the video clip is more than just eye candy.


[1] "Where Are the Great Plains? A Cartographic Analysis," Sonja Rossum and Stephen Lavin, Professional Geographer 52(3), 543-552 (2000).

[2] "Population Dynamics of the Great Plains: 1950 to 2007," Steven G. Wilson, U.S. Census Bureau (2009).

[3] "The Geologic Story of the Great Plains," Donald E. Trimble, U.S. Geological Survey Bulletin 1493 (1980).


Next: Back to the Beginning


Last updated Mar 4, 2018