Author Topic: Fusing two .tcx files.  (Read 8946 times)

Fusing two .tcx files.
« on: October 02, 2011, 02:40:39 pm »
I have two tcx files that I want to merge for the purposes of DIY by GPS validation. The GPS nunit decided to switch itself off at one point, hence the two files.  How the bloody hell do I do it? I tried cutting and pasting the second file onto the end of the first in Notepad, but it wouldn't have it.

Confused of Gloucestershire.

RichForrest

  • T'is I, Silverback.
Re: Fusing two .tcx files.
« Reply #1 on: October 02, 2011, 02:47:47 pm »
Just send both, sometimes I get 2 or 3 in a zip file and they open in the software together. Other times I just open them separately to validate them.
They will be fine as it's only proof that you have passed through the controls in a specified time that counts.
The route between them doesn't matter as the shortest distance has been ok'd beforehand.

Rich

Re: Fusing two .tcx files.
« Reply #2 on: October 02, 2011, 02:50:44 pm »
Ah thanks Rich. I did send them, in a fit of pique, after trying for half an hour to merge them.  It has taken a week for me to have guilt pangs.  ;D

Re: Fusing two .tcx files.
« Reply #3 on: October 02, 2011, 03:19:41 pm »
I've not tried this but I did read this thread on the Garmin forum. Seems to suggest they can be merged either via XSLT or a java prog. Usual rules about downloading s/w from forums but might be worth a shot?

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

Re: Fusing two .tcx files.
« Reply #4 on: October 02, 2011, 03:24:05 pm »
Thanks, but to be honest that starts to stray into territory into which my ICBA side pops out  ;D

fuaran

  • rothair gasta
Re: Fusing two .tcx files.
« Reply #5 on: October 02, 2011, 04:18:49 pm »
You could import them both into Garmin Basecamp, then join the tracks (Edit menu -> Advanced -> Join selected tracks), then export as a TCX file.

Re: Fusing two .tcx files.
« Reply #6 on: October 02, 2011, 04:48:54 pm »
Ah. First I'll have to find out what Garmin Basecamp is. Thanks, I'll give it a whirl.

Jaded

  • The Codfather
  • Formerly known as Jaded
Re: Fusing two .tcx files.
« Reply #7 on: October 02, 2011, 05:11:03 pm »
An XML file is just a set of nested tags. All you need to do is strip the appropriate tail tags off the first file and the top tabs off the second file. After two beers that should be easy.
If you don't like your democracy, vote against it.

Re: Fusing two .tcx files.
« Reply #8 on: October 03, 2011, 06:23:55 pm »
Further to Jaded's post.

Using notepad (or even better, use foxe):
  • For the 1st file, delete all the tags from (and including) the <Creator xsi:type="XXXX"> tag onwards. The last tag should now be </Lap>.
  • For the 2nd file, copy all the tags from (and including) the first <Lap StartTime="YYYY-MM-DD..."> tag onwards, paste at the end of the 1st file and Save As "combined.tcx".

Re: Fusing two .tcx files.
« Reply #9 on: May 21, 2012, 11:36:46 pm »
This entry is a duplicate of what I posted at http://yacf.co.uk/forum/index.php?topic=58702.msg1236152#msg1236152
Thought it might also be appropriate to relist it here:

I've encountered the "Edge 800 crash after 400km" three times. After the first two times I returned the unit to Garmin and they replaced it.
The new unit had the same issue. After a bit a research I found that a number of other people had experienced the same issue.
There are a few entries on the Garmin forums eg:
https://forums.garmin.com/showthread.php?t=17002

Until Garmin confirm a definite fix for the issue a way round this problem is to reset your activity at a "safe" distance of say 300km and then merge the multiple activities into one.
I tried a few different ways of doing this:

Garmin Basecamp - Can join activities, but only a basic track. You loose other info like heart rate and cadence.

TCX Converter - Can join two activities, but seems to consistently corrupt very long rides, placing random points several thousand km away. It also can't deal with activities spaning two or more days.

CombineActivities.jar - This works in so much that it successfully joins the two activities. The problem is that you need to copy and paste the result from the program into a text file. Most computer operating systems can't cope with this, due to the size. I found that Windows 7 and Mac OSX couldn't deal with 2x200km, Ubuntu Linux could. Even Linux couldn't cope with 2x300km

Ascent - I've successfully used the free trial version of this software to join two 300km .fit files. Unfortunately this software is only available for Max OSX.

Training Peaks - I read somewhere that you could do this on the desktop version of this product. They now seem to have a web based version. I've not tried it.

If anybody knows any other methods other than Ascent please share.

David Martin

  • Thats Dr Oi You thankyouverymuch
Re: Fusing two .tcx files.
« Reply #10 on: May 21, 2012, 11:53:03 pm »
I'd do it by hand in a text editor. But then I am a bit old-school hackerish.

It should be a very short python script along the lines of

import xml.dom.minidom
doc1=xml.dom.minidom.Document(filename1)
doc2=xml.dom.minidom.Document(filename2)
creator=doc1.getElements("Creator")
for e in doc2.getElements("Lap"):
  creator.insertBefore(e)
print doc1.asxml()

This won't work as I haven't looked up the proper methods but should be pretty close to what you can do.

..d
"By creating we think. By living we learn" - Patrick Geddes

fuaran

  • rothair gasta
Re: Fusing two .tcx files.
« Reply #11 on: May 22, 2012, 12:05:51 am »
Garmin Basecamp - Can join activities, but only a basic track. You loose other info like heart rate and cadence.
Have you tried the latest version of Basecamp (currently v 3.3.3)? Older versions stripped the heart rate data, but that has since been fixed. It works fine for me anyway - joining/splitting activities from my Forerunner or Foretrex, then exporting as GPX or TCX. The exported files have all of the heart rate data (I've not got a cadence sensor).

Or Garmin Training Center should also be able to do this.
Or you could try SportTracks.

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: Fusing two .tcx files.
« Reply #12 on: May 22, 2012, 08:54:57 am »
I'd do it by hand in a text editor. But then I am a bit old-school hackerish.

Surely the easiest and IMO the safest way.  If you combine stuff in software, you don't know what else it might be doing to the data.
It's not dark yet but it's getting there.