Jump to content
  •  

How to Merge Different GPX tracks to Create One Track


Looper

Recommended Posts

Disclaimer: I don't know how to code or what it means. I just recognize patterns and go from there.

I was trying to merge a couple of tracks into one and in my research found the following that might be useful if anyone wants to try.

GPX files that you have which are recordings of GPS tracks are basically *.xml files that you can open on Notepad app or any text editor on your computer. Some apps do a better job than Gaia in structuring the file. Gaia GPS is just a bunch of code dumped into a *.gpx file. Here I have tried to separate them for easy reference.

There are 3 parts to the GPX file 

1. Start: The initial header data such as how it was created, the name of the track, description if any, color of the track etc.  

<?xml version="1.0" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="GaiaGPS" version="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">

<trk>

<name>
IM0148A, Al Quaa, Abu Dhabi - Gaurav Soni
</name>

<desc>
this file is combined from Gaurav Soni recordings
</desc>

<extensions>

<line xmlns="http://www.topografix.com/GPX/gpx_style/0/2">

<color>
00B2FF
</color>
</line>

</extensions>

<trkseg>

<trkpt lat="23.477482" lon="55.217087"><ele>115.0</ele><time>2022-11-12T05:08:11Z</time></trkpt>
<trkpt lat="23.477484" lon="55.217087"><ele>115.0</ele><time>2022-11-12T05:08:20Z</time></trkpt>

2. Track Point Data: for every second or so the Gaia or any other recording app will make an entry in to the record.
 

The track point data is contained between <trkseg> and </trkseg>. Each track point is consist of Latitude (lat), Longitude (lon), Elevation (ele) and date and time of recording. Time is mentioned in the file is GPS time which is almost same as UTC. The latitude and longitude is described in Decimal Degrees. 

<trkpt lat="23.477482" lon="55.217087"><ele>115.0</ele><time>2022-11-12T05:08:11Z</time></trkpt>
<trkpt lat="23.477484" lon="55.217087"><ele>115.0</ele><time>2022-11-12T05:08:20Z</time></trkpt>
<trkpt lat="23.477482" lon="55.217091"><ele>115.0</ele><time>2022-11-12T05:08:21Z</time></trkpt>

3. End: Towards the end the file is closed 

<trkpt lat="23.40979" lon="55.358162"><ele>123.0</ele><time>2022-11-12T12:01:20Z</time></trkpt> 
<trkpt lat="23.409809" lon="55.358177"><ele>125.0</ele><time>2022-11-12T12:01:26Z</time></trkpt> 

</trkseg>
</trk>
</gpx>

 

Note: I have kept 2 rows of Track Point data in both Start and End for referance only

How to Combine: 

Say you have 3 tracks then export them to desktop in *.gpx files format.

  1. You have to keep the start point and track point data and delete the ending of the file that starts at </trkseg> copy the text into a new text file and save it with extension *.gpx
  2. For the middle track copy the Track Point Data. and paste it in the new file you do not need the start or end portions of this file.
  3. For the last track, copy the Track Point Data and End data, and now you can save the new file and import that to Gaia GPS to see a new combined file. It will be imported into a new folder in Gaia.

My referance Files:

Combined File (I even changed the color, name and description while creating the combined file on the desktop) 

Track1

Track2

PS: Personally, I wouldn't stop recording till the drive is completed, meh! that's just me. 

Edited by Looper
Updated 2.Track Point Data
  • Well Done (+2) 2

don't drive like its your last one.

Link to comment
Share on other sites

Good topic. I use the web browser of Caltopo for that. You don't even need a subscription:

1. Open Caltopo

CalTopo - Backcountry Mapping Evolved

2. On the left hand side, click on IMPORT and select your gpx tracks and waypoints you want to club together.

image.png.fcd29c9e77d637bd34ac4e256739dc1c.png

 

3. Once you've imported your tracks, now select EXPORT, and choose the format "GPX". 

image.png.53796632dbcb03f03b9a65a77965fcd8.png

 

You will now end up with 1 gpx file with all your tracks and waypoints inside of it,

This is handy to basically create 1 GPX file that contains all tracks and waypoint from a certain time range, area, emirate, or as you wish to categorize them.

  • Like (+1) 1
  • Well Done (+2) 1

"Go as far as you can see; once you get there, you'll be able to see further."

Link to comment
Share on other sites

I think if we put 2 tracks in Gaia in a folder an export even that will perhaps do the trick.

image.jpeg.6e498f3bd8ded04bf849dc46a7a3e888.jpeg

 

 

 

 

don't drive like its your last one.

Link to comment
Share on other sites

5 minutes ago, Looper said:

I think if we put 2 tracks in Gaia in a folder an export even that will perhaps do the trick.

image.jpeg.6e498f3bd8ded04bf849dc46a7a3e888.jpeg

 

 

 

 

yes you are right, but i hate the folder/subfolder system of Gaia.... :)

 

  • Haha (+1) 1
  • Totally Agree (+2) 1

"Go as far as you can see; once you get there, you'll be able to see further."

Link to comment
Share on other sites

Thanks for kicking this off @Looper! As we’ve already discussed on IG, I absolutely despise the folder architecture of Gaia. I’m sure it incentivizes well organized folks like yourself but I’m a labels and tags kinda organizer so I can see the same data in a variety of different ways. This should at least allow me to fill in the blanks by creating one large tracks than the trippy Pink Floyd color explosion on my Gaia right now 😂

  • Like (+1) 1
Link to comment
Share on other sites

@Looper really interesting topic! Have you ever tried using Chatgbt to attempt to simplify code? I regularly use it when I can't figure out an issue with C# or C++, just an idea especially when trying to learn how to code 🙃 

  • Like (+1) 1
Link to comment
Share on other sites

I am an accountant by profession with MIS and Financial Reporting specialization. Excel is my bread and butter. While I use a little bit of VBA code in a few spreadsheets; I don't really understand how it does what it does. I am generally as amused as the next person who is in awe of my spreadsheets lol.

But I do, however, use Chat GPT. to help me with some documents in the regular work (e.g. corporate secretarial work, drafting agreements etc.) and it does a fair job. It prepares the initial draft for me to build up on.

  • Like (+1) 1

don't drive like its your last one.

Link to comment
Share on other sites

10 hours ago, Looper said:

I think if we put 2 tracks in Gaia in a folder an export even that will perhaps do the trick.

image.jpeg.6e498f3bd8ded04bf849dc46a7a3e888.jpeg

 

 

 

 

Gaia GPS does not combine tracks when exported as folder; it exports the tracks inside the folder and when imported, the folder with its individual tracks are put back again.

Today has been full of tasks that failed successfully.

don't drive like its your last one.

Link to comment
Share on other sites

Updated Track Point data with following:

The track point data is contained between <trkseg> and </trkseg>. Each track point is consist of Latitude (lat), Longitude (lon), Elevation (ele) and date and time of recording. Time is mentioned in the file is GPS time which is almost same as UTC. The latitude and longitude is described in Decimal Degrees.

don't drive like its your last one.

Link to comment
Share on other sites

Looks like CalTopo also does the same thing that Gaia GPS does exports/imports a bunch of tracks as indiviudal objects and does not merge them as One Continuous Track. Today I had to merge 10 differnt tracks so I imported them and exported them back. But when I re-imported into CalTopo; it imported the combined file as ten different objects and not as a single object - was I doing something wrong?

On a side note; I like the fact that CaTopo shows the individual track names on the map. It would be easy when viewing tracks on the maps. In Gaia I hate that I don't know what track I am looking at. 

  • Like (+1) 1

don't drive like its your last one.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

Terms of use