Forums >Technical Support>How to join GPX files?
HobbyJogger & HobbyRacer
This isn't necessarily for Eric; it is for anyone familiar with GPX files who cares to answer.
I'd like to join two GPS tracks -- from the same run, in two segments recorded on two watches. They're not quite contiguous -- the first track covers perhaps 25mi, and the second track covers perhaps 20mi, and there is some gap between them. (But I hope that doesn't matter.)
I obtained (or will obtain) these by uploading from a watch to RA, then saving as GPX. I've only obtained one so far, actually.
It looks like this:
<?xml...>
<gpx...>
<metadata>
<time>...</time>
</metadata>
<trk>
<trkseg>
<trkpt lat="..." lon="...">
<ele>...</ele>
</trkpt>
... (lots more trkpt elements, just like the above one
</trkseg>
</trk>
</gpx>
So, each point has a latitude, a longitude, and a time (and whatever an ele is).
So my question is: how can I attach the second set to the first set?
I will produce it the same way, so I expect to get another sequence of track points (trkpt), and just need to figure out how to concatenate them to what I already have.
Should I dump another track after the first one, copying in the entire trk element? Or should I copy only the entire track segment (trkseg) element into the same track element?
What is the purpose of the metadata time element -- do I need a second at the start of the second track, if I do an entire other track?
Every point has time anyway, so I don't know really why the metadata time is very useful.
Judging by this schema, http://www.topografix.com/GPX/1/1/gpx.xsd
it appears to me that there can be multiple tracks, and a track can have multiple track segments.
I don't know what difference it would mean logically whether I record the two parts of the run as one track with two segments, or as two tracks.
It's a 5k. It hurt like hell...then I tried to pick it up. The end.
I've just realized that each track segment is a "lap".
Right.
Been a while since I have done this, but I have just opened in a text or XML editor and appended the trk nodes from one file to the other:
<trkseg file a>
<trkseg file b>
I'm running somewhere tomorrow. It's going to be beautiful. I can't wait.
Poor baby
Doughboy
Darn. Too slow. But yeah, something like that.
When I did it I think I used output directly from Garmin Training Center, and it combined nicely.
It worked. Thanks. It's funny that the laps are no longer exactly 1mi each, but that's ok.
© 2013 RunningAHEAD, LLC. All rights reserved. | Privacy