Flight tracking and realtime sharing with CouchDB
published by natevw on — Subscribe
I've been avidly collecting a record of my whereabouts almost as long as I've been using a digital camera, and always on the lookout for more ways to collect this data. One fun way I've found when traveling by air, is to take advantage of the free flight tracking maps often found on in-flight WiFi portals. Even before you've activated full internet service, you can get access to a web map that shows your location/airspeed/ETA live — similar to the old monitors in the bulkhead, but on your own device.
I've written a couple scripts to politely poll this data and record it into my CouchDB instance. This works even if I don't buy WiFi, since the fetch request is always available and the store request goes to my laptop's local database server.
We can take things a step further, though, once fully connected to the Internet: continuously replicate the local database to a publicly-available one, then use its _changes feed directly to share a map of where I am with everyone — updating live.
It's a simple matter of shuffling some JSON around to the right places. I'm using my Fermata library to poll from node.js and fetch in the browser, and Polymaps for a lightweight map display engine, and both the data and the web app are simply handled by CouchDB. The end result is that with hardly a dozen lines of custom code on either the frontend or the backend, we have a reasonably robust realtime personal location tracking system – built and deployed while still above the clouds!