
Speak in Geotongues: GPSBabel to the Rescue #51
Chapter 5, Mapping with Gadgets
|
225
HACK
Using GPSBabel to Merge Files
You can specify more than one input file and more than one output file, so
you can use GPSBabel to merge multiple files. This command will merge the
GPX-format waypoint files way1.gpx and way2.gpx and put them into both
the GPX file merge.gpx and the Geocaching loc file cache.loc:
$ gpsbabel -i gpx -f way1.gpx -f way2.gpx -o gpx -F merge.gpx -o geo -F
cache.loc
This is useful when you have multiple files full of waypoints and you want
to create one canonical list. This is especially useful when combined with
the
-x duplicate filter (discussed in “Using Filters”) to remove waypoints
that mark the same place.
Using Filters
GPSBabel also lets you filter your results. This command takes two GPX files
as inputs and then outputs those waypoints within five miles of 40.75ºN,
119.25ºW into the GPX file merge.gpx:
$ gpsbabel -i gpx -f way_iii.gpx -f way_rino.gpx \
-x radius,distance=5M,lat=40.75,lon=-119.25 -o gpx -F merge.gpx
You can also filter waypoints by different criteria. This command searches
two GPX files, way_iii.gpx and way_rino.gpx; outputs all the waypoints that
are within 10 miles of the toll plaza of the Golden Gate Bridge; and then
sorts that list by waypoint name. Since there is no output type (
-o),
GPSBabel sends the output to the terminal:
$ gpsbabel -i gpx -f way_iii.gpx -f ...