How TrailLife makes a video
A program builds a 3D model of your hike from public data, then films it one frame at a time.
What goes into it
- Elevation. Heights come from the Terrain Tiles dataset on AWS, which Mapzen assembled from public elevation sources. TrailLife turns them into a terrain grid with a point every 8 metres. The sources are listed in the dataset's attribution.
- Aerial photos. Where they exist, the ground is coloured from NAIP, the US government's aerial photos. The photos' own sun shading is removed so the video's lighting is the video's own. Outside the US, or where NAIP has no photo, the video uses a plain palette instead.
- The route, lakes and places. Trails, lakes, peaks and trailheads come from OpenStreetMap (© OpenStreetMap contributors).
- The hiker's pace. How fast your hiker walks comes from Tobler's hiking function, which gives walking speed from the slope of the ground.
The pace formula
Tobler's function, with the slope as rise over run (a 10% climb is 0.1):
speed = 6 · e−3.5 · |slope + 0.05| km/hIt peaks at 6 km/h on a gentle 5% downhill, gives about 5 km/h on flat ground, and slows on climbs and on steep drops. TrailLife applies it to each stretch of your route's own heights to time the walk. If you enter the hours you took, TrailLife stretches those times to fit them.
The frames
The video is 20 seconds at 30 frames a second: 600 frames. A 3D renderer draws each frame from the terrain, the route and the hiker's place at that moment, and ffmpeg joins them into the file. Making the video takes about 3 minutes, most of it starting a machine, building the terrain and drawing the frames.
Where the picture on the card comes from
While your video is made, the card shows the terrain the renderer is filming, thinned out so it fits on a phone, with your route on it. The dot is where your hiker is in the frame being drawn. It is read from the video's own files, not animated for show.
Where a language model is used
Typing a place into the search box uses a language model to work out which place you mean. Picking a place from the list does not. The video itself is made only by the steps above.
Back to TrailLife