def average_speed(opts = { units: 'kilometers' })
      case opts[:units]
      when /kilometers/i
        distance / (moving_duration / 3600.0)
      when /meters/i
        (distance * 1000) / (moving_duration / 3600.0)
      when /miles/i
        (distance * 0.62) / (moving_duration / 3600.0)
      end
    end
def average_speed(opts = { units: 'kilometers' })
      case opts[:units]
      when /kilometers/i
        distance / (moving_duration / 3600.0)
      when /meters/i
        (distance * 1000) / (moving_duration / 3600.0)
      when /miles/i
        (distance * 0.62) / (moving_duration / 3600.0)
      end
    end
Returns the average speed, in km/hr, meters/hr, or miles/hr, of this
 GPXFile.  The calculation is based on the total distance divided by the
 sum of duration of all segments of all tracks
 (not taking into accounting pause time).