Perhaps a sign of the times that I spent a recent Sunday & Monday evening cobbling together some POC-standard code and built http://gpxhyperlapse. A sign of the times that the code is 99% client-side!
I like to run – part of the #SPRunners (SharePoint runners who attempt to live a semi-healthy life, e.g. at conferences by getting up early and running, even in Vegas!)
I found myself wanting to share the routes I had run, but not just from a mapping perspective, from my perspective, what I see when I run; Jersey is beautiful and many of the Green Lanes (15mph speed limit) are great for running around and exploring the countryside, then there are the long coastal routes.
It’s hard to convey this without actually filming it, but I don’t have a GoPro, so I thought about the Google Street View footage and if I could use their APIs to generate a hyperlapse of my routes. Here is a recording of one:
The main inspiration came from:
- http://hyperlapse.tllabs.io/ – original Google Street View hyperlapse work; truly amazing
- http://strava.com – I log all my activities here and the API is great (OAuth2) and is FREE (not like Garmin who charge $5,000… ridiculous!)
- I also forked this code (https://github.com/gusfraser/Hyperlapse-GPX) and published to an Azure-hosted website (cheap, easy, secure!)
The more interesting elements were:
- Calculating the angle of travel from which to grab the right Google image
- Google can let you know the degrees from North that the camera is facing for an image, but I also needed to work out what direction I was running; in theory that would be a straight line between the current GPS position and the previous one, but that isn’t 100% accurate
- Identifying the optimum number of GPS points to use for a distance (currently it works best for runs of up to 20km – longer than that e.g. bike rides means loading a lot more data so takes longer)
- Obtaining the GPS points from Strava – actually this was easy once I worked this out, but initially I had been trying to get the GPX file itself rather than the raw data; their API and docs are great and their dev team responded quickly with a query I had really promptly
Next challenges/feature requests collected so far:
- Saving & sharing a route
- I want to save on server resources if possible, so I may save the array of Google points and still need to load the images themselves (easy option)
- Creating a video (e.g. using ffmpeg to create an MP4 from PNGs) would be possible server-side but using more resources
- Integration with RunKeeper’s Health Graph
- Shouldn’t be too difficult
- Utilising true Hyperlapse techniques to improve the quality (e.g. Microsoft Research’s technology, if possible)
- UI improvements – speed up/slow down UI features including loading low quality first (e.g. Netflix/YouTube streaming that buffers to start) – need to manage how quickly the frames are loading before streaming
- Includes better tablet/iPad integration; works best on desktop currently
Leave a Reply