Author Topic: Stitching together .gpx fragments from a ride to one .gpx with SW for a Mac?  (Read 2383 times)

Uncle Eric

On Sat I had my Garmin Edge 705 with me on a long ride. Unfortunately
the connection to the external battery kept coming off. Every time that happened
the Garmin switched off and I had to reload the course and start recording all
over again from the point on the route I happened to be on.

So I ended up with five .gpx fragments of the route.

Does anyone know of some MacOS X Snow Leopard SW that can
be used to stitch together the .gpx fragments to one continuous one?
With times recalculated so the whole ride looks proper?

Would like to save this ride and route since it was a nice one!  :)

PC SW would work too, but preferably for Mac.

Jaded

  • The Codfather
  • Formerly known as Jaded
Any text editor will do this, as long as the files are properly made XML files.

You can probably do it in TextEdit, open them up and copy the text from each later one into the first file.

If you look at the structure of the files you will see which XML tags you need to remove to make it one file. What you'll probably get is straight jumps between the end of one fragment and the start of the next, depending on the time that the machine was 'off-line'.
It is simpler than it looks.

PaulF

  • "World's Scariest Barman"
  • It's only impossible if you stop to think about it
I think Garmin Road Trip may do that - otherwise it should be fairly simple to edit the files in a text editor.


fuaran

  • rothair gasta
You could do this with GPSBabel.
Just specify all of the GPX files as inputs, and use the "Pack" filter.

interzen

  • Venture Altruist
  • Agent Orange
    • interzen.homeunix.org
Any text editor will do this, as long as the files are properly made XML files.
Which, if they are kosher GPX files, they will be.
I've used a text editor1 to stitch GPX files together on multiple occasions - it's relatively easy providing you know which bits to delete and which to leave alone. Recalculating the timestamps is a bit more involved, however. All that said, if you're dealing with very large fragments, the potential for screwups is greatly increased.

I'd not be surprised if at least one of the online route planners allows you to import multiple GPX files, mash them together and re-export them as a single file.

Nowadays, I use a Mac app of my own design to do various interesting things to GPX files (split, merge, general mucking about with) prior to uploading them into my iOS GPS apps, but unfortunately it's nowhere near ready for the big time2 (which is to say it's entirely command-line driven and has no user-interface to speak of)

1 - vim. http://www.vim.org/
2 - which is not to say I'm not prepared to distribute it at all, but it would take someone terminally brave and/or foolish to use it in its current form (unless they're me)

frankly frankie

  • I kid you not
    • Fuchsiaphile
Keep the <trkseg></trkseg> tags and everything between, and put them all in a single <trk></trk> (in the right order of course).
I don't see any point in frigging the timestamps - assuming you want as accurate a record of your ride as possible you want to keep them as they are.
when you're dead you're done, so let the good times roll

Uncle Eric

Thanks for the suggestions. Will have a go at text edit. Know XML quite well but haven't actually looked inside a .gpx. Thought it would be some other format. If the timestamps are the actual wall clock times, no checksums and all is just plain XML sounds easy enough to stitch five parts like that in an editor!  :thumbsup:

It's just XML, the gpx schema is defined here
http://www.topografix.com/GPX/1/1/
and the garmin site has the schema for their extensions

Times are jsut strings