Welcome

Purpose

A collection of command line tools for using GPX files written in C++. The specification of the GPX file format is listed here.

Usage

gpxls

List the contents of GPX-files

Usage: gpxls [OPTION].. [FILE]..
List summary or full information from GPX-files.
   -?, --help      display this help and exit
       --version   display version and exit
   -s, --summary   display summary information
   -f, --full      display full information

Examples:

gpxls track.gpx

  Display a summary of the track.gpx file: the waypoints, routes, tracks and track 
  segments information.

gpxls -f track.gpx

  Display full information of the track.gpx file: the waypoints, routes, route points, 
  tracks, track segments and track points.

gpxjson

Convert the waypoints, routes and/or tracks in a GPX-file to a GeoJson-file

Usage: gpxjson [OPTION].. [FILE]
Convert a GPX-file to GeoJson.
   -?, --help                  display this help and exit
       --version               display version and exit
   -w, --waypoints             convert the waypoints
   -t, --tracks                convert the tracks
   -r, --routes                convert the routes
   -m, --mode\=compact|normal   set the output mode (def:normal)
   -p, --points\=NUMBER         set the number of points per line in normal mode (def:4)
   -o, --output\=FILE           set the output file

Examples:

gpxjson -w -m compact track.gpx >output.json

  Convert the waypoins in the track.gpx file to Multipoints in the output.json file. All points are on the
  same line (compact mode).

gpxjson -t -m normal -n 6 track.gpx >output.json

  Convert the track points in the track.gpx to MultiLinestrings in the output.json file. All points are
  grouped by 6 per line (normal mode).

gpxjson -r -m normal

  Read the route points from standard in and convert them to MultiLinestrings that are written to
  standard out in normal mode (4 points per line).

gpxcoord

Show all formats for gps coordinates and optional the location in the browser.

Usage: gpxcoord [OPTION].. [LAT LON]..
Display the LAT LON gps coordinate in different formats.
   -?, --help              display this help and exit
       --version           display version and exit
   -b, --browser\=BROWSER   set the browser

Examples for gps coordinate formats:
         51.90540,     4.46660
        -51.90540,    -4.46660
      N 51 54.324,  E 4 27.996
      51 54.324 S,  4 27.996 W
     N 51 54 19.4, E 4 27 59.8
     51 54 19.4 S, 4 27 59.8 W

Examples:

gpxcoord 51.90540 4.46660

  Show all formats for the gps coordinates 51.90540,4.46660.

gpxcoord -b firefox "51 54.324 N" "4 27.996 E"

  Show all formats for the gps coordinates 51 54.324 N,4 27.996 E and show the location in the browser.

gpxcoord -- -51.90540 -4.46660

  Show all formats for the gps coordinates -51.90540,-4.46660 (use -- to prevent parsing -51.90540 
  as parameter).

gpxplot

Generate a GnuPlot command file from the distance, elevation, speed and time in a GPX-file on standard output.

Usage: gpxplot [OPTION].. [FILE]
Generate a GnuPlot command file from a GPX-file on standard output.
   -?, --help             display this help and exit
       --version          display version and exit
   -t, --title\=TITLE      set the title of the plot
   -x, --x\=SOURCE         set the x-axis source (distance, time) (def:time)
   -y, --y\=SOURCE         set the y-axis source (elevation, distance, speed) (def:speed)
   -p, --plot\=STYLE       set the plot style (lines,..) (def:lines)
   -c, --color\=COLOR      set the line color
   -m, --term\=x11|qt|..   set the output device and options
   -w, --width\=WIDTH      set the width of the plot
   -h, --height\=HEIGHT    set the height of the plot
   -o, --output\=FILE      set the output file of the plot

Examples:

gpxplot -t "Track" -c "red" -o track.png -w 1024 -h 512 track.gpx | gnuplot

  Generate a command file for GnuPlot which will display a plot with time and speed from track.gpx 
  in a red line in a PNG image with the size 1024 x 512.

gpxplot -t "Track" -y elevation track.gpx >track.plt
gnuplot track.plt
  
  Generate a command file for GnuPlot which will display a plot with time and elevation from track.gpx
  in the default viewer.

gpxplot -t "Track" -o track.png -m "pngcairo enhanced font'Verdana,10'" -w 1024 -h 512 track.gpx | gnuplot

  Generate a command file for GnuPlot which will display a plot with time and speed from track.gpx 
  in a PNG image with the size 1024 x 512 using a specific terminal and its options.

Requirements: GnuPlot for plotting

gpxrm

Remove waypoint, track or route from GPX-file and display the resulting file on standard output.

Usage: gpxrm [OPTION].. [FILE]
Remove waypoint, track or route from GPX-file.
   -?, --help            display this help and exit
       --version         display version and exit
   -w, --waypoint\=NAME   remove the waypoint with NAME
   -t, --track\=NAME      remove the track with NAME
   -s, --segment\=NR      remove only segment in track with NR
   -r, --route\=NAME      remove the route with NAME

Note: Use gpxls to find the waypoint, track or route name.

Examples:

gpxrm -t 'Track1' track.gpx >output.gpx

  Remove the track 'Track1' from the track.gpx file and store the result in output.gpx file.

gpxrm -t 'Track2' -s 2 track.gpx

  Remove the second tracksegment from the track 'Track2' in the track.gpx and display the
  result on standard output.

gpxsplit

Split the track segments in a GPX-file in multiple track segments based on distance or time and display the resulting GPX on standard output.

Usage: gpxsplit [OPTION].. [FILE]
Split the track segments in a GPX-file.
   -?, --help                       display this help and exit
       --version                    display version and exit
   -a, --analyse                    analyse the file for splitting
   -d, --distance\=METRES            split based on a distance
   -t, --time\=YYYY-MM-DD HH:MM:SS   split based on a timestamp
   -s, --seconds\=SEC                split based on a time difference in seconds
   -m, --minutes\=MIN                split based on a time difference in minutes
   -h, --hours\=HOURS                split based on a time difference in hours

Examples:

gpxsplit -a -d 4000 track.gpx

  Check if the track segments in the track.gpx file can be split based on a distance of
  4000 metres. gpxsplit reports the results, no GPX-file is written to standard output.

gpxsplit -d 4000 track.gpx

  Split the track segments in the track.gpx file based on the distance between track points
  of 4000 metres. The resulting GPX-file is written to standard output.

gpxsplit -t '2018-10-24 09:03:00' track.gpx >output.gpx

  Split the track segments in the track.gpx file based on the timestamps of the track points.
  The resulting GPX-file is written to output.gpx.

gpxsim

Simplify a route or track using the distance threshold and/or the Douglas-Peucker algorithm and display the resulting GPX-file on standard output.

Usage: gpxsim [OPTION].. [FILE]
Simplify a GPX-file.
   -?, --help                display this help and exit
       --version             display version and exit
   -v, --verbose             display the results of the simplification
   -d, --distance\=METRES     remove route or track points within distance of the previous point in METRES
   -n, --number\=NUMBER       remove route or track points until the route or track contains NUMBER points
   -x, --crossTrack\=METRES   remove route or track points with a cross track distance less than METRES

Examples:

gpxsim -v -d 1 track.gpx

  Display the result of the simplification of the track.gpx after using the distance threshold,
  no GPX-file is written to standard output.

gpxsim -x 1 track.gpx

  Simplify the track.gpx file using the Douglas-Peucker algorithm. All points with a cross track
  distance of less than 1 metre are removed. The resulting GPX-file is written to standard output.

gpxsim -n 500 track.gpx >output.gpx

  Simplify the track.gpx file using the Douglas-Peucker algorithm until there are 500 points
  remaining. The resulting GPX-file is written to output.gpx.

gpxcat

Concatenate the track segments in a GPX-file and display the resulting GPX-file on standard output.

Usage: gpxcat [OPTION].. [FILE]
Concat the track segments in a GPX-file.
   -?, --help              display this help and exit
       --version           display version and exit
   -d, --distance\=METRES   concat only if both segments are less than METRES apart

Examples:

gpxcat track.gpx >output.gpx

  All track segments in the track.gpx file are concatenated per track and written to output.gpx.

gpxcat -d 12.0 track.gpx

  All track segments in the track.gpx file for which the distance between the end of the segment
  and the start of the next segment is smaller than 12 metres are concatenated per track. The
  resulting GPX-file is written to standard output.

Building

The gpxtools depend on the STL and Expat. For gpxplot the gnuplot tool is required. You will also need CMake (>=2.8.0) for building the tools.

Package

No packages available. See git for the source.

License

The tools may be freely distributed under the terms of the GPL.