Hack 56. Animate Your Tracklogs

Get more from your tracklogs by making them move.

Maps are static things. We dump our tracklogs on a map, and there they sit like old Popsicle sticks, marking the carcass of something that was good at the time but now is done. Tracklogs represent movement, so what if we could animate our tracklogs to keep alive that sense of motion? Well we can. If you have a tracklog in a GPX file, you can animate it at http://www.mappinghacks.com/projects/animate. If you have a tracklog that is not in GPX format, then review [Hack #51] .

Click the link "Simple Animation of a Track Log," Select a tracklog from your system in GPX format and click on "Make Animation," as shown in Figure 5-27. You can also upload a waypoint file in GPX format.

Figure 5-27. The simplest way to animate a tracklog: animate.cgi

You'll get a simple animation like that shown in Figure 5-28. But do you see the problem? Exactly! The printed version shows all the animation of a Tupperware party on the moon. Fortunately the web version is a tad more active.

Figure 5-28. Trust me: on the Web, this swings


5.12.1. Hacking the Hack: Do More with Geo::Track::Animate

This animate script uses the Perl module Geo::Track::Animate to create a Scalable Vector Graphics (SVG) image. With a bit of programming, you can do even more! First install the module from CPAN:

$ perl -MCPAN -e "install Geo::Track::Animate"

As usual with CPAN modules, a look at the documentation is a good first step:

$ perldoc Geo::Track::Animate

The animation at http://www.mappinghacks.com/projects/animate uses the sample script animate.cgi, which comes with the Geo::Track::Animate module, in the eg directory. This serves as a good example of how to use the module.

The animate.cgi script accepts a single GPX file, but Geo::Track::Animate accepts multiple tracklogs and can animate all of them. See the example in the script eg/animate_tracks.pl, which allows you to animate multiple GPX track files, with an optional file of waypoints:

$ ./animate_tracks.pl -wayfile mywaypoints.gpx tk*.gpx

This command will animate the tracklogs in all of the GPX files that start out with the letters tk and overlay the waypoints contained in mywaypoints.gpx. The output file will be stored in testfile.svg.

5.12.2. See Also

The "Geo::Track::Animate" page at http://www.mappinghacks.com/projects/animate for more examples and sample code.

Mapping Your Life

Mapping Your Neighborhood

Mapping Your World

Mapping (on) the Web

Mapping with Gadgets

Mapping on Your Desktop

Names and Places

Building the Geospatial Web

Mapping with Other People

Mapping Hacks
Mapping Hacks: Tips & Tools for Electronic Cartography
ISBN: 0596007035
EAN: 2147483647
Year: 2004
Pages: 172

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net