[SOLVED] Extracting tracks from single GPX into individual files?


I need a Windows application that can read a big GPX file that contains hundred’s of tiny tracks, and save each track into an individual GPX file such as:

<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="togpx"><metadata/><trk><name></name><desc></desc><trkseg><trkpt lat="48.91888968903368" lon="1.6328430175781252"/><trkpt lat="48.78967599441185" lon="1.6149902343750002"/><trkpt lat="48.776102781718585" lon="1.7770385742187502"/><trkpt lat="48.780627593814906" lon="1.7015075683593752"/><trkpt lat="48.814098527355746" lon="1.7344665527343752"/></trkseg></trk><trk><name></name><desc></desc><trkseg><trkpt lat="48.80405583270132" lon="2.0426138956099753"/><trkpt lat="48.802953462220664" lon="2.040725620463491"/><trkpt lat="48.79933279859402" lon="2.0397923793643717"/><trkpt lat="48.801436476249386" lon="2.0251750946044926"/><trkpt lat="48.7978318253408" lon="2.015016814693809"/><trkpt lat="48.79877231645694" lon="2.013940326869488"/><trkpt lat="48.800655426583766" lon="2.0138850901275878"/><trkpt lat="48.800787819968164" lon="2.0103820413351063"/><trkpt lat="48.80392391719761" lon="2.0232009887695317"/></trkseg></trk></gps>

I tried GpsBabel and JaVaWa RTWtool, but they seem unable to do this.

I know I could write a script for this, but was wondering if there some ready-to-use application.

Thank you.

Hi, GPSPrune is mentioned quite a lot in this forum for manipulating GPS/GPX files :- https://activityworkshop.net/software/gpsprune/index.html


Can GpsPrune really extract tracks from GPX files into separate files?

I went through the menus and googled for “gpsprune tracks extract” but didn’t find infos on how to do this.


To be as clear as possible:

  1. Open the big GPX file as input:

<gpx xmlns=“http://www.topografix.com/GPX/1/1” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version=“1.1” creator=“togpx”>

  1. Have the application save each … section into its own, individual GPX file.

The problem here may be that this is too easy in a Unix environment, for anyone with basic scripting knowledge. As such, there may be little incentive to produce a nicely packages tool to do what can be done in very few lines of code.

Thought so, but…

  1. even in *nix, not all users have the skills to write a script, even fewer if running desktop *nix mandated at work
  2. in Windows, it’s probably even more rare
  3. I’m surprised none of the usual suspects* supports such an obvious feature.

So, Python it is.

Thank you.

  • GpsBabel, gpsprune, etc.

https://github.com/SomeoneElseOSM/osmimport_02 (which I wrote for my own use) does this. It does a lot of other things as well though; I’m not sure how easy it would be to use it to “just split tracks”.

Thanks, I’ll give it a try.