AI GPX track repair

Clothes, tools, technology, nutrition, training, techniques, etc.
User avatar
tekewin
Posts: 1344
Joined: Thu Apr 11, 2013 5:07 pm

Post by tekewin »

I use a Garmin GPS to map my tracks in the mountains. It's pretty reliable, but there are two situations where I might end up with an incomplete track. Either I didn't get good satellite locks when I started, leaving missing points at the beginning or my batteries died on the way back leaving missing points at the end of the file. Sometimes I can replace the batteries and the track will continue, but sometimes it starts a new track and I have to glue them together.

Track files are stored in a special XML format with a .gpx extension in human readable text. Track points use this format:
<trkpt lat="36.5897951648" lon="-118.2299466245"><ele>2422.18</ele><time>2025-07-15T12:25:43Z</time></trkpt>

As long as the outbound and return paths were the same, you can figure out where the missing points are and copy them, in reverse order, from beginning to the end or vice versa depending on where they are missing to repair the track. It can be tedious and time consuming.

I've set up a customized version of ChatGPT to do this kind of repair automatically. So far, the O3 model is the only frontier model that understands the GPX format. You need a ChatGPT account (it can be a free account) to use this tool.

https://chatgpt.com/g/g-686edab80db0819 ... r?model=o3

How it works:

1) Upload your GPX file that needs to be repaired.
2) The AI will analyze the file to determine where the missing points are.
3) It calculates the nearest set of points that need to be copied, then it reverses the order and inserts the points in the right place.
4) It also calculates the differences in time stamps between points and assigns the right estimated time stamp to the new points it added by either adding or subtracting the time deltas. It should not modify the headers or any other part of the file.
5) When complete, it provides a file download link.

It has successfully repaired Garmin generated files with points missing at the beginning or end, but comes with no warranty.
User avatar
dima
Posts: 1667
Joined: Wed Feb 12, 2014 1:35 am
Location: Los Angeles

Post by dima »

How can you be sure it will do the right thing for data you haven't tried it on? :)
User avatar
tekewin
Posts: 1344
Joined: Thu Apr 11, 2013 5:07 pm

Post by tekewin »

dima wrote: Sat Jul 19, 2025 1:10 pm How can you be sure it will do the right thing for data you haven't tried it on? :)
I am not sure it will do the right thing. It has worked well on my files, but only after tweaking the prompts a few times. This version should handle most cases where the missing points are at the start or end and the route was the same.

It writes python code to compute where to start adding and also for the time math.

I manually verified my small number of test cases and created profiles and kmz files from them.

But it could totally flop on the next file!