I have a similar problem with a GPS where the CPU sometimes takes too long to get out of idle / sleep mode when the data is arriving.<br><br>So I implemented an algorithm that looks for the largest subset of points that does not contain any jumps or faults. So for example if samples 2, 7, 8 and 9 are timestamped 1970-01-01 while the remaining 5 samples are timestamped correctly, the algorithm will be smart enough to drop all 4 incorrect samples, even though sample 8 matches up with its neighbours. The algorithm is based on the shortest path algorithm.<br>
<br>Instructions for filtering NMEA through it is here :<br><a href="http://wiki.openstreetmap.org/wiki/Converting_NMEA_to_GPX#Gosmore_NMEA_to_GPX_conversion">http://wiki.openstreetmap.org/wiki/Converting_NMEA_to_GPX#Gosmore_NMEA_to_GPX_conversion</a><br>
<br>Regards,<br>Nic<br><br><div class="gmail_quote">On Wed, Mar 11, 2009 at 6:16 AM, Simon Wood <span dir="ltr"><<a href="mailto:simon@mungewell.org">simon@mungewell.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
I was wondering how to filter out 'obviously wrong' points from a GPX track log, which was recorded in heavy tree coverage. The track log was mostly good, but had a few outlying (individual) points, which would have been hard to find by hand given 1s data for 1 1/2 hours.<br>

<br>
As it took me a while to work out I thought I would document it here, as it might be of use to someone else. I did this by using GPSBabel to compute the speed for each point and then used awk to filter out (drop) points which exceeded a threshold.<br>

<br>
$ gpsbabel -t -i gpx -f track.gpx -x track,speed -o unicsv -F temp.unicsv<br>
$ head -n 1 temp.unicsv > new.unicsv<br>
$ head -n -1 temp.unicsv | awk -F ',' '{if ($5<20) print $0;}' >> new.unicsv<br>
$ gpsbabel -t -i unicsv -f new.unicsv -x transform,trk=wpt -o gpx -F new.gpx<br>
<br>
The awk script could be made more complicated (ie. calculate acceleration over several samples) to give an even better result.<br>
<br>
The difference is clear:<br>
$ ./wherewasi.py track.gpx --summary<br>
<br>
<br>
                WhereWasI Output<br>
                =================<br>
<br>
        Filename=track.gpx<br>
        Number of Track Segments        = 1<br>
        ---------------------------------------------<br>
        Start Segment / Point   = 0/0<br>
        End Segment / Point     = 0/5365<br>
        Start Time              = 07/03/2009 17:35:20<br>
        End Time                = 07/03/2009 19:04:51<br>
        Number of Track Points  = 5366<br>
        ---------------------------------------------<br>
        Total Time              = 01:29<br>
        Total Distance          = 12.03 km<br>
        Total Climb             =  4761 m<br>
        ---------------------------------------------<br>
        Average Speed           =  8.06 km/hr<br>
        Maximum Speed           = 1239.35 km/hr<br>
        ---------------------------------------------<br>
<br>
<br>
$ ./wherewasi.py new.gpx --summary<br>
<br>
<br>
                WhereWasI Output<br>
                =================<br>
<br>
        Filename=new.gpx<br>
        Number of Track Segments        = 1<br>
        ---------------------------------------------<br>
        Start Segment / Point   = 0/0<br>
        End Segment / Point     = 0/5316<br>
        Start Time              = 07/03/2009 17:35:20<br>
        End Time                = 07/03/2009 19:04:50<br>
        Number of Track Points  = 5317<br>
        ---------------------------------------------<br>
        Total Time              = 01:29<br>
        Total Distance          =  9.86 km<br>
        Total Climb             =  3469 m<br>
        ---------------------------------------------<br>
        Average Speed           =  6.61 km/hr<br>
        Maximum Speed           = 66.82 km/hr<br>
        ---------------------------------------------<br>
<br>
Cheers,<br>
Mungewell.<br>
<br>
PS. Wherewasi can be found here:<br>
<a href="http://code.google.com/p/wherewasi/" target="_blank">http://code.google.com/p/wherewasi/</a><br>
<br>
_______________________________________________<br>
talk mailing list<br>
<a href="mailto:talk@openstreetmap.org">talk@openstreetmap.org</a><br>
<a href="http://lists.openstreetmap.org/listinfo/talk" target="_blank">http://lists.openstreetmap.org/listinfo/talk</a><br>
</blockquote></div><br>