How to edit GPX files in a text editor
Jump to navigation
Jump to search
This is an example of how to edit GPX files in a text editor based on this task: delete an trackpoint entry from the gpx file
Summary
Just open it up in a text editor and delete the entire trackpoint entry from the xml.
Here's one of my trackpoints that I don't need:
<trkpt lat="-37.772000" lon="145.024740"> <ele>111.781</ele> </trkpt>
Steps
Here are your rough steps:
- Open the track log
$ java -jar josm-latest.jar 20070915.gpx
- put your mouse over the cloud of points to be deleted, and write down the coordinates
- Open the track log in your favourite text editor (or emacs, or Microsoft WordPad, or whatever)
$ vi 20070915.gpx
- Search for the co-ordinates you wrote down, leaving off the last part for precision.
- Delete all points either side, by looking at the time. You should be able to work out when you stopped moving and roughly when you started again.
- If you cross over a
<trkseg>
take out the end of the first</trkseg>
and the beginning of the next, so you'd just end up with one<trkseg>
. - After editing, you can run the resulting gpx file through GPSBabel going from gpx to gpx, and it will rebuild a correct bounding tag, which is nice if you've chopped a really long file into smaller bits.
See also
- Edit GPS tracks – Editing GPX tracks and list of usable software