Martin's technology blog – OpenStreetMap

Blog content

Latest posts

Active categories:

More tags ...

By date:

    (No recent posts)

Blog calendar

January 2022
Mo Tu We Th Fr Sa Su
 << Dec Feb >>
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Fixing GPS tracks chopped up by OpenStreetMap's Potlatch

posted by Martin Rubli at 16:21

The other day, while uploading some GPS tracks to OpenStreetMap, I noticed that Potlatch reproducibly chops up some of my traces into pieces, which makes them quite hard to turn into paths. Here's an example of an affected track:

Apparently I wasn't the only one with this problem, but with a fix - or even a proper explanation - outstanding, I did a little investigation.

The good news: The gaps in the track don't stand for lost points but for long straight lines. Therefore the easiest fix is to simply convert all track parts into paths and connect their ends. If your track is short or is only cut up into a small number of pieces that works great.

The better news: There's a batch processing solution for it, which works great for longer and more heavily chopped up tracks. Not surprisingly the solution involves GPSBabel.

I didn't spend much time on finding the optimum value, but a quick inspection suggested that Potlatch was cutting up the track between points that were more than about 100 m apart. With GPSBabel's interpolation filter it's an easy task to interpolate points whose distance is less than that:

gpsbabel -i gpx -f chopped.gpx -x interpolate,distance=0.095k -o gpx -F fixed.gpx

And there you go, the fixed track looks just the way it should:

Of course, now that you know the problem you can also tune the settings on your GPS device to make sure the logging interval is low enough. That way at least your future tracks won't cause you the same headaches. Happy mapping!