Qball's Weblog

GPX-viewer point filtering

Tags gpxviewer 

I wrote a small GPX-Viewer program as you might know. (See this site).

One of the problems with GPX-Viewer is that libchamplain gets pretty slow with complex routes that have a lot of points. So I thought, why not try to filter out points?

The idea is simple, if  you have 3 points: A->B->C and if C is just a linear  continuation of A and B we can remove B.

So I wrote a small algorithm that checks if the speed in the latitude and longitude both do not deviate more then 30% (got this by trail and error) then the point in-between is removed. So large speedup or moves should not be removed. I will probably push a lower value to be on the safe side.

This algorithm seems to be working very good; I get a 22% reduction of points and the deviation I see in the updated track and the original track seems to be limited.

Here is a small screenshot showing the largest distance I found, as you can see we are still on the road.

I will look this week if I can find some paper on filtering GPX tracks, it would be nice to also remove false points, sometimes with bad receptions you get very odd points in the track that are clearly wrong, would be nice to remove those. (I got an algorithm for this, but it is not tested and thought out very well)

Forgot to mention, I ignore the elevation for now, it seems to be unreliable. But that is a problem with my Garmin having a very unreliable height measurement.