Saturday, December 31, 2011

What's in the tracking data, anyway?

As mentioned in an earlier post, most races providing online tracking are using Spot devices to collect and uplink the GPS data and Trackleaders to display the data on maps.  Trackleaders is actually doing quite a bit more than just showing the tracks, and part of the reason that the tracking shows the quirks it does is because there's only so much one can do with certain kinds of data.  This post started out as a discussion of where team speed data come from and how seriously to take it but that turned out to be a much more complicated question than I expected, so I'm moving that discussion to a subsequent post.  This one is just focused on what Spot actually does and the data it provides to trackers.

Spot Satellite GPS Messengers are simple GPS units with a satellite uplink.  They've got a very simple user interface: no display and a small number of buttons used to turn on tracking, send a check-in message, or send a custom message that can be programmed into the owner's account through the web interface.  There are also two covered buttons for emergency use: an "I need help" button that sends a message to the individual(s) of your choosing, and an "I need help" button that sends a message to the GEOS International Emergency Response Center.  There's no display.  They'd be nearly foolproof if fools weren't so incredibly resourceful.



The tracking function has the Spot upload data about current location to a server owned by Spot (the company) every 10 minutes.  The interval is not settable, and really needs to be fairly large because radio operations (i.e. the uplink) chew up battery.  Because this process is completely opaque to pretty much everybody except for Spot we can't know what it's actually sending.  However, the company makes Spot data available through what's known as an API, or application programming interface, and that's how software developers, hobbyists, and various other sorts of nerds are able to develop applications that use the data.  A description of their API is here.   They've defined their own XML schema (it's a data format - let's just leave it at that) and they use it to expose the data.  So, a developer who wants to use the data sends a request to Spot saying "give me the data for whatever" and gets back a chunk of XML that looks something like this:

〈?xml version="1.0" encoding="utf-8"?〉
〈messageList〉
  〈totalCount〉3〈/totalCount〉
  〈message〉
    〈esn〉0-8198546〈/esn〉
    〈esnName〉MelindasSPOT〈/esnName〉
    〈messageType〉TRACK〈/messageType〉
    〈timestamp〉2011-12-31T01:22:21.000Z〈/timestamp〉
    〈timeInGMTSecond〉1325294541〈/timeInGMTSecond〉
    〈latitude〉64.87184〈/latitude〉
    〈longitude〉-146.94133〈/longitude〉
  〈/message〉
  〈message〉
    〈esn〉0-8198546〈/esn〉
    〈esnName〉MelindasSPOT〈/esnName〉
    〈messageType〉TRACK〈/messageType〉
    〈timestamp〉2011-12-31T01:12:21.000Z〈/timestamp〉
    〈timeInGMTSecond〉1325293941〈/timeInGMTSecond〉
    〈latitude〉64.87184〈/latitude〉
    〈longitude〉-146.94133〈/longitude〉
  〈/message〉
  〈message〉
    〈esn〉0-8198546〈/esn〉
    〈esnName〉MelindasSPOT〈/esnName〉
    〈messageType〉TRACK〈/messageType〉
    〈timestamp〉2011-12-31T01:02:21.000Z〈/timestamp〉
    〈timeInGMTSecond〉1325293341〈/timeInGMTSecond〉
    〈latitude〉64.87184〈/latitude〉
    〈longitude〉-146.94133〈/longitude〉
  〈/message〉
〈/messageList〉

In this example I took my Spot, put it into "Track" mode, and set it out on a rock or a car or some other large object with a clear view of the sky for a few minutes.  You'll note that the latitude and longitude in the messages remains unchanged - that's why.  I just wanted to collect a few messages to show the how the data are presented to the programmer.

So basically what we've got is a set of three message, each set off by a "message" tag.  Each message contains identifying information, message type, the time at which the data were collected represented as an ISO 8601 string (programmers love this stuff), the time at which the data were collected represented as the number of seconds since 00:00:00 UTC, January 1 1970 (yes, really - programmers really love this stuff), and the latitude and longitude.  All told it's really not that much data, and the astute reader who can tolerate looking at XML or who noticed the post title may have noticed that one key piece of data for race tracking is missing:  speed.  And that's the topic of our next blog post.

No comments:

Post a Comment