For Offa’s Dyke however, I really wanted to do something special to let friends, family and other interested parties, feel part in our adventure.
So I created this: http://www.mycountryside.org.uk/viewranger.php?date=2010-02-20 – this example shows our 17 mile walk in the Surrey Hills. This post explains what the app does and how, fairly non-technically, it works.
Ever since I decided to walk Offa’s Dyke, I had the idea in my head to create some kind of interactive map which showed our progress. With modern, GPS enabled, smart phones there are a range of possibilities of how you can capture your physical position, however I was keen to try and keep it simple and only use a limited number of applications whilst hiking.
I already use Viewranger on my GPS enabled mobile phone, which provides Ordnance Survey maps on mobile devices. Viewranger has an existing feature called BuddyBeacon, which allows you to automatically ping your location (as well as other information like heading, speed and altitude) to their servers – and they have recently released an API which gives you accesses to this information.
The app accesses the Viewranger BuddyBeacon API and stores the information in a database. The app then checks for duplicates, which occur when you have long breaks, and merges the data (by taking an average).
”Geotagging” Twitter and Twitpic
Using the Twitter API, the app downloads and stores in the database both new tweets from @offasdyke4ms (it also pulls in the updates of @winkysmileyface, my fellow walker), but also any new replies (you will see why shortly). The app also accesses the offasdyke4ms Twitpic feed, and stores in the database any new photos. [Technical detail – the Twitter, Twitpic and Viewranger updates are done automatically every 15 minutes using a server cronjob.]
There are many mobile apps which allow you to access Twitter (and Twitpic) on the move – for example Gravity on S60, Seesmic on iPhone and Android, and dabr.co.uk (via a browser) on most mobiles. As well as the sometimes significant battery drain whilst using mobile internet access, I also tend to find these apps to be frustrating to use in remote areas where the mobile data signal fades in and out. I have set up my mobile number to allow me to update Twitter by text, but unfortunately my mobile provider doesn’t support inbound Twitter tweets. To get around this, the app can use the Bulksms API to text any new replies to my phone (this does cost money, although currently a customer of mine is kindly allowing me to use their account!).
As the offasdyke4ms Twitter updates are imported, the app looks for the hashtag ‘#viewr’ – if the tag is present, the app attempts to link the status update with a Viewranger beacon position. It does this by finding the last beacon position before the Tweet (if it was in the last 15 minutes). The Tweet is now effectively geotagged! (once geotagged, the app removes the hash tag from the status as it is stored in the database).
All new Twitpics (images uploaded from my phone) are geotagged using the Viewranger data in the same way (no hashtag is required – all images are geotagged).
Building the Map
The app then takes all this information and, using the Google Maps API, displays it on the map for a specific day as a route. The app works out which icon to display based on the available information, a green blob for the first beacon, a red blob for the last beacon, a twitter icon, a twitpic icon, a twitter/twicpic icon or a grey blob. By default the map loads the current day’s route, if one is available, otherwise you can select a previous route from the select box. If you are walking when someone goes on the site, the app zooms in on the last beacon and automatically opens the latest info window.
Each info window shows the location information from Viewranger – altitude, speed and heading, as well as any related geotagged tweets and twitpics. The app also displays, as a threaded conversation, any replies to geotagged tweets (and subsequent replies).
The descriptions of each route can also be set by twitter – tweeting “#viewr start location1” sets the start location, “#viewr end location2” sets the end location and “#viewr notes description” sets any additional description for the current day.
Of course I can’t forget those friends on Facebook who don’t use Twitter, or won’t necessarily visit the website. Using Hootsuite, the app can export a feed of the tweets containing the hashtag #fb to my Facebook profile or page.
I would love to hear any suggestions of how I can improve the app – I hope in the future, when I have time to clean up the code, to release it (for free) for other people to use.