This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A solution for combining/merging two TCX files (activies)

Former Member
Former Member
This weekend I needed to adjust my interval workout while it was in progress (yes, I needed a break!) This resulted in me having two different activities and two TCX files for each.

I searched and downloaded various software, but they didn't do exactly what I wanted. (Some didn't preserve the calories, and some turned the workout into a course, etc)

I then tried just copying all the laps from one TCX to the other using notepad, but that didn't work either. The distance was corrupt when I uploaded to Garmin Connect. I realized that the the individual laps in each activity have a cumulative distance tracker. So all I needed to do to make this work is offset the last distance tracked to all of the distances from the other activity.

I created a simple XSLT transform that can be applied to two TCX files and it will create a new merged activity.

Thought I'd share.

(Note, you'll need a XSLT processor like saxon/xalan or others)
  • Former Member
    0 Former Member over 10 years ago
    Hi, Mike.

    Here are my two files: the GPX is from my etrex and the TCX is my TrainingCenter file from my Forerunner.

    https://www.dropbox.com/s/j2pa329wl03esr8/2014-08-17%20%5BR%5D%2075%20Meije.gpx
    https://www.dropbox.com/s/iuvymltot63sf0z/2014-08-17%20%5BR%5D%2075%20Meije.tcx

    As I said, I can merge them but when I view the result in Garmin Connect they events are staggered. In TrainingCenter it appears to be correct.

    Regards,

    Scott
  • Former Member
    0 Former Member over 10 years ago
    hi Scott,

    Was the distance of this activity about 75km? Does this pic look right?

    cheers
    Mike
  • Former Member
    0 Former Member over 10 years ago
    That was quick! Yep, that's the route.
  • Former Member
    0 Former Member over 10 years ago
    hi Scott,

    Give this file a try please and let me know what you think.

    Note that there aren't any speed values in the file due to you using a 5 sec data recording setting. The Fit File Repair Tool isn't able to correctly calculate speed if anything other than 1 sec data recording is used - it is something that the developer is aware of and is working to come up with a solution for.

    cheers
    Mike
  • Former Member
    0 Former Member over 10 years ago
    Mike,

    Thanks for the file. The two device files are sync'd but as you point out the timing is now all to pot - I could only wish for a 55km/h average. Looking at the software download page £32 is a steep price to pay for something that - for me - doesn't work. Looks like I'm stuck with having two separate entries in Connect. Perhaps my best plan is to save up for a Garmin Edge?

    Thanks again for your help.

    S
  • Former Member
    0 Former Member over 10 years ago
    Hi Scott,

    Give this new file a try - it now contains the correct speed info, average and max within, so FFRT will actually do what you need it to do.

    Big thanks however must go to DATEZZ, for letting me know what it was that I was doing wrong and what the correct way for this type of merge is - thanks heaps Don.

    Scott - should you decide to purchase FFRT, then I will be more than happy to explain what it is that you need to do to merge your files.

    cheers
    Mike
  • Former Member
    0 Former Member over 10 years ago
    Is this still working for people? I am trying to merge 2 activities I did today, and upon uploading them to garmin it gets stuck around 40%. I am inputting them in to the java file as the .tcx files in order, copypasting the results into notepad, and saving it as ridename.tcx, I try to upload to Garmin and then that's when it hits the 40% rut.
  • Former Member
    0 Former Member over 10 years ago
    hi BDFoster,

    Attach the two files in a reply to this post or if they are too big then get yourself a free Dropbox account, upload the two files to there and then share the links to them in your reply.

    I will then append the two files for you using the Fit File Repair Tool.

    cheers
    Mike
  • I'm computer literate but I have no idea how to utilize CombineActivities.jar. When double-clicking on the file, it unpacks the contents in a WinRAR window. What do I do now? I have two .tcx files to merge and have absolutely no idea how this works. I would be most appreciative if someone could please offer a dummy, step-by-step tutorial.

    Thank you very much!
  • Former Member
    0 Former Member over 10 years ago
    I just whipped up a quick and dirty Java program that is self contained and easy to execute.

    Make sure you have Java installed, then...

    Download this .jar file, and then double click it.

    CombineActivities.jar


    Hi aim4min would there be any chance of obtaining the source code for this? If not did you use the Garmin SDK or did you just serialise in the tcx xml and join them that way? Thanks