Calculating the time to hike a trail in an automated way is very difficult. The inevitable challenge is that difficult terrain can dramatically slow down progress, and that can’t necessarily be inferred from the data alone. For example, a perfectly flat and straight boulder field could slow you down to 0.5 km per hour, whereas an easy path on the same route, you could do anywhere up to 6-6.5 km per hour for a very fit person.

We take multiple approaches to achieve the best possible, but still deeply flawed, prediction of time to hike a trail, and more often than not override it with information from users or other sources that is more reflective of an actual user experience. Here we will address just the automated process, as the user experience, while likely more accurate, is much more subjective.

The overall ethos is a conservative estimation, with a preference to overestimate and try to never underestimate.

For the more technically inclined, this is our algorithm for calculating walking time.

def add_duration_minutes
  coords = geo_data['features'][0]['geometry']['coordinates']
  total_mins = 0
  mins_per_meter_of_distance = 0.015
  mins_per_meter_of_ele_gain = 0.12
  mins_per_meter_of_ele_loss = 0.05
  coords.each_with_index do |coord, index|
    next if coords[index + 1].nil?

    first = RGeo::Geographic.spherical_factory.point(coord[0], coord[1])
    second = RGeo::Geographic.spherical_factory.point(coords[index + 1][0], coords[index + 1][1])
    distance = first.distance(second)
    total_mins += distance * mins_per_meter_of_distance

    first_ele = coord[2]
    second_ele = coords[index + 1][2]

    total_mins += if first_ele > second_ele
                    (first_ele - second_ele) * mins_per_meter_of_ele_loss
                  else
                    (second_ele - first_ele) * (mins_per_meter_of_ele_gain
                                                + (second_ele > 3000 ? 0.3 : 0.0))
                  end
  end
  self.duration_minutes = total_mins.to_i
  save
end

  • The key variable here are:
    • Minutes per meter of distance which we have set as 0.015 mins.
      • Nazimiths rule states that it will take approximatly 1 hr for every ~5km, or 0.012 minutes per meter of distance. We have applied a more conservative estimation of 0.015 mins per meter, or 1hr for every 4km.
    • Minutes per meter of elevation gain which we have set as 0.12 mins.
      • Nazimiths rule states that it will take approximatly 1 hr for every 600m of elevation gain, or 0.1 minutes per meter of elevation gain. We have gone with a more conservative estimate of 0.12 mins per meter, or 1hr for every 500 meters of elevation gain.
      • One other caviate to this that we have added is that, we add 0.3 mins per meter for elevations gains that are above 3000 meters of altitude. Hike at significant altitude has an impact on your ability to perform physically. With the ethos of conservatisim, we have implemented this to reflect that somewhat.
    • Minutes per meter of elevation loss which we have set at 0.05 mins.
      • Nazimiths rule doesnt state a particular addition for dropping elevation, but form our experience, and others, it does slow you down. We applied an estimate of 0.05 mins for every meter of elevation loss, or 1hr for every 1200 meters of elevation loss.

It’s important to remember that these figures are deeply flawed for the early mentioned reasons, but are something that we continuously work on to improve. We are now starting to integrate terrain data from OSM, to try to further improve these figures, but even then, the accuracy is not perfect.

Weather

Another significant element that can impact the estimation is the current weather conditions. Poor conditions, such as windy and/or wet conditions, snowy, or walking on snow or ice, can have massive implications for hiking time. We are working to build these estimations into the application by taking current weather data for the route, and applying a modifier based upon that. This is not currently live, but in our beta products, we are taking a simplistic approach, of essentially doubling the time per meter when conditions are poor.

Any ideas to make this better! Comment or reach out to paul@hiiker.co

Blog at WordPress.com.

Discover more from HiiKER

Subscribe now to keep reading and get access to the full archive.

Continue reading