[GPSBabel] Merge multiple GPX files, only keeping tracks?

Discussion in 'GPS Software' started by Winfried, Mar 8, 2017.

  1. Winfried

    Winfried

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Hello

    I need to merge 20-40 GPX files into a single GPX file, while removing waypoints during the process (I only need tracks).

    I looked around the GPSBabel GUI application, but found nothing obvious, and the website displays nothing when clicking on either Support or Documentation.

    Can the CLI application do this?

    Thank you.
     
    Last edited by a moderator: Mar 9, 2017
    Winfried, Mar 8, 2017
    #1
  2. Winfried

    Winfried

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Tried this, to no avail: No trace of "merge.gpx".

    Open DOS box

    cd "folder/of/file"

    setlocal enabledelayedexpansion

    set f=for %%f in (*.gpx) do set f=!f! -f "%%f"

    gpsbabel -i gpx !f! -o gpx -F "merge.gpx"​

    What am I doing wrong?
     
    Last edited by a moderator: Mar 9, 2017
    Winfried, Mar 9, 2017
    #2
  3. Winfried

    Nuvi-Nebie Moderator

    Joined:
    Aug 16, 2015
    Messages:
    2,345
    Likes Received:
    201
    Location:
    UK
    There a many free programs that will allow the contents of GPX files to be merged, Garmin Basecamp is one, also the older Garmin Mapsource will do this
     
    Nuvi-Nebie, Mar 9, 2017
    #3
  4. Winfried

    Winfried

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Thanks, I'll check it out.

    Is there really no way to use some kind of "*.gpx" to feed multiple files into GpsBabel?
     
    Winfried, Mar 9, 2017
    #4
  5. Winfried

    Nuvi-Nebie Moderator

    Joined:
    Aug 16, 2015
    Messages:
    2,345
    Likes Received:
    201
    Location:
    UK
    The problem you may get in merging GPX files, is that the GPX can contain a lot of different data, e.g. any combination of single or multiple Waypoints, Tracks and Routes, so if the GPX's contain different types of data format it may be difficult to produce a single working file, that is why I said you may have to merge the contents of the files, rather than merging the files
     
    Nuvi-Nebie, Mar 9, 2017
    #5
  6. Winfried

    Winfried

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Thanks for the info.

    Indeed, here's what happens after I use GpsPrune to merge GPX files into a single file, and import it in Google My Maps:

    GPX.to.GMM.glitches.png

    Why does this occur?

    Also, why are timestamps so important in GPX files, even when users only care about the route, not speed?

    --
    Edit: Same issue when importing the file in GPSVisualizer, but it gets worse when importing the whole route in yet another site (www.visugpx.com):
    VisuGPX.glitch.import.full.GPX.png
     
    Last edited: Mar 10, 2017
    Winfried, Mar 10, 2017
    #6
  7. Winfried

    Nuvi-Nebie Moderator

    Joined:
    Aug 16, 2015
    Messages:
    2,345
    Likes Received:
    201
    Location:
    UK
    Are you trying to merge GPX files into a single GPX file, or merge tracks into a single track?, the first option would say, take 40 GPX files containing a single track and produce a single GPX file containing 40 separate tracks, the second would also produce a single GPX file but it would contain a single track by joining all the tracks together. You will have a problem with the second option, if, for example you had track from London to Brighton and a track from Sydney to Adelade and joined then together there would be a single step from Brighton to Sydney, this may be what you see in the straight parts of your examples
     
    Nuvi-Nebie, Mar 10, 2017
    #7
  8. Winfried

    Winfried

    Joined:
    Mar 8, 2017
    Messages:
    7
    Likes Received:
    0
    Thanks much.

    The original GPX files I downloaded each contained a single track, and I needed to merge all the files into a single GPX since Google My Maps only takes one file per layer.

    After experimenting, I found a solution:
    1. If need be, make sure the GPX filenames are sequential to match the route, eg. 01.gpx, 02.gpx, etc.*
    2. Run this to merge the files into a single GPX file:

      SET APP="c:\Program Files\GPSBabel\gpsbabel.exe"
      setlocal enabledelayedexpansion
      set f=

      for %%f in (*.gpx) do set f=!f! -f "%%f"

      %APP% -t -i gpx %f% -x nuketypes,waypoints -o gpx -F merge.nuked.gpx


    3. Upload into a new layer in Google My Maps
    4. If you wish, select and remove each and every start/stop endpoints.

    Thank you.

    * That's the problem I had: The files weren't named sequentially, and I assumed the application (GpsBabel, etc.) would figure out the whole route
     
    Winfried, Mar 11, 2017
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.