One way to make a chunk o'media better is to know where it was created!
We talk about geocoding photographs elsewhere (see [Hack #39] ), but what about other media? How about that digital voice recorder? A recording athletic heart-rate monitor? Even SMS messages have timestamps. If you have GPS tracklogs, then you can use a simple web site to geocode anything! The trick is to use timestamps and tracklogs to determine where you were when you created a file.
You can geocode any media that has a timestamp using the linkmedia tool at http://mappinghacks.com/projects/linkmedia/. This hack uses the linkmedia.cgi script that is included with the Perl module Geo::Track::Log. Select the link to "linkmedia," and you get the web page shown in Figure 5-35.
Figure 5-35. linkmedia.cgi file selection page
This program lets you upload a text file that I call a "media description file," along with a GPX-format tracklog file. A media description file contains one line for each item to be geocoded. The first field is a filename, followed by the pipe symbol (|), and a date and timestamp, followed by another pipe. Anything else can appear after the date and timestamp. Here is a sample line from a media description file:
You can create the media description file in any text editor for any media that you have. For example, you can create a media description file for a list of photographs. As it happens, I created this module so that I could geocode audio files and create audio travelogues. I have an Olympus DS-330 Digital Voice Recorder that allows me to record sound clips and download them to my computer in individual DSS format files. Each file contains a header with the date and time that the clip was started, and some other information. I created the Perl module Audio::DSS to extract this metadata and output it in the media description file format.
Audio::DSS is available on CPAN. It includes the script dumpdss.pl that extracts DSS-file metadata. The script is in the eg/ directory. Copy dumpdss.pl to somewhere in your path, and then change directories to your audio file directory.
$ dumpdss.pl FolderB/*.dss
Here is a partial list of these files, along with their metadata. The first field is the filename; the second is the date the sound clip was started, when it was completed, the time in seconds, and a comment. The DSS Recorder software lets you add a comment of up to 100 characters. The first time I tried to do this I was reminded of the importance of synchronizing the time on my voice recorder with my GPS:
FolderB/DS330271.dss|2004-09-06 21:22:55|2004-09-06 21:23:06|000010|Start Segment| FolderB/DS330278.dss|2004-09-06 21:24:32|2004-09-06 21:24:52|000020|Why is it that color?| FolderB/DS330279.dss|2004-09-06 21:29:21|2004-09-06 21:29:28|000007|News on the radio| FolderB/DS330343.dss|2004-09-06 21:38:53|2004-09-06 21:39:45|000052|Rock'M Sock'M robot action!|
You can geocode the media description file and output a media description file with latitude and longitude added to it by clicking on "link media."
39.589177|-119.441896|FolderB/DS330271.dss|2004-09-06 21:22:55|2004-09-06 21:23:06| 000010|Start Segment| 39.582250|-119.469884|FolderB/DS330278.dss|2004-09-06 21:24:32|2004-09-06 21:24:52| 000020| Why is it that color?| 39.555830|-119.561804|FolderB/DS330279.dss|2004-09-06 21:29:21|2004-09-06 21:29:28| 000007| News on the radio| 39.529747|-119.728585|FolderB/DS330343.dss|2004-09-06 21:38:53|2004-09-06 21:39:45| 000052| Rock'M Sock'M robot action!|
But wait, there's more! If you click on "show track stats," you will get statistics about your GPX file, as shown in Figure 5-36.
Figure 5-36. GPX Tracklog statistics
I've long been interested in the geospatial component of what people do, since everything that people do has a geospatial component. After all, we are somewhere whenever we do anything. This tool does not actually require a GPS unit or a real tracklog. As shown in [Hack #98], you can geocode historic documents and events, and then use tools like these to extend the narrative and add additional context.
See http://mappinghacks.com/projects/linkmedia/ for more on geocoding, mapping arbitrary media, and creating online voice-annotated travelogues.