[OSM-talk] Removing home point cloud(s) from multiple GPX files

Alan Millar am12 at bolis.com
Sat Apr 18 21:22:47 BST 2009

Karl Newman wrote:
> I want the same thing, and I looked into doing this with GPSBabel, too, and
> while it has the capability to filter points inside or outside a radius (or
> polygon, etc.), that function does not work on trackpoints, and the author
> had said something to the effect of "it doesn't make sense to have it
> enabled for trackpoints because it would make false tracks (jumps, etc.)".

Here is what I do for this.  This is a Linux shell batch script, but
should be adaptable for DOS batch files.

This converts the trackpoints to waypoints, filters on them, and then
converts back to trackpoints.  It deletes any names added to the waypoints
(trackpoints) in the process.

It also breaks out the tracks to separate output files based on time gaps
in the captured data.  That way I just capture one big file but get
multiple files out.


gpsbabel    \
        -i nmea -f "$InputFile"         \
        -x discard,hdop=5.5     \
        -x transform,wpt=trk,del        \
        -x polygon,file=$ExcludeFile,exclude    \
        -x transform,trk=wpt,del        \
        -o gpx -F -     \
    | grep -v -e '<name>' -e '<cmt>' -e '<desc>'        \
    | gpsbabel  \
        -i gpx -f -     \
        -x track,pack,split=5m,title="T%Y%m%d-%H%M"     \
        -o gpx -F -     \

Your exclude file would contain polygon coordinates something like:

# West Hyland Hills
# -122.8252,45.4622,-122.8145,45.4755
45.4622 -122.8252
45.4622 -122.8145
45.4755 -122.8145
45.4755 -122.8252
45.4622 -122.8252
# East Hyland Hills
# -122.8145,45.4657,-122.8058,45.4755
45.4657 -122.8145
45.4657 -122.8058
45.4755 -122.8058
45.4755 -122.8145
45.4657 -122.8145

Like most free solutions, this is a starter example and not a complete
solution; you'll need to tweak it to your situation...

The primary thing lost in this scenario is probably any waypoints in the
original capture.  (I don't capture waypoints myself so I didn't
accomodate for that.)  There are probably some more steps you can do to
split those off first.

Good luck,

- Alan

More information about the talk mailing list