NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

2
1

I am using my GPX files in photo and video processing, and at times need to back track to older archives. I have currently blended all my GPX files into a combined archive, but this is now too big, so that many of the tools I am using are unable to find the data.

I am therefor looking for a tool or shell commands I can use to split the combined archive into monthly files (or if that is still too big, daily files) That way I don't have to look through my entire database in order to find the correct traces.

gpsbabel might be possible, but filtering is still confusing for me.

asked 09 Jan '16, 22:10

Skippern's gravatar image

Skippern
166157
accept rate: 33%


gpsbabel can do the low-level filtering for you, but it is a bit awkward, especially if your GPX file has more than one data type (route, track, or waypoint). You would then have to wrap this in a script to process by month or day or whatever.

Here are some examples.

If you have a GPX file of only tracks, and you want only tracks from the year 2014 (2014-01-01 to 2015-01-01), you could use something like this:

gpsbabel -i gpx -f in.gpx \
   -x track,start=20140101,stop=20150101 \
   -o gpx -F out.gpx

Make sure none of your tracks crosses the start or stop date/times, because gpsbabel filters the trackpoints (not the tracks) by trackpoint date/time, and you will end up with partial tracks.

If your GPX file has only waypoints, you have to transform them to use the filter:

gpsbabel -i gpx -f in.gpx \
    -x transform,trk=wpt,del \
    -x track,start=20140101,stop=20150101 \
    -x transform,wpt=trk,del \
    -o gpx -F out.gpx

If your GPX file has both waypoints and tracks, you have to run 2 passes, once per type. Then merge the results (if desired).

gpsbabel -i gpx -f in.gpx \
    -x nuketypes,tracks,routes \
    -x transform,trk=wpt,del \
    -x track,start=20140101,stop=20150101 \
    -x transform,wpt=trk,del \
    -o gpx -F out_w.gpx

gpsbabel -i gpx -f in.gpx \ -x nuketypes,waypoints,routes \ -x track,start=20140101,stop=20150101 \ -o gpx -F out_t.gpx

gpsbabel -i gpx -f out_w.gpx -f out_t.gpx -o gpx -F out.gpx

Doing this for routes 'is left as an exercise for the reader'.

permanent link

answered 10 Jan '16, 23:33

ljb_nj's gravatar image

ljb_nj
659101727
accept rate: 12%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×255
×9
×4

question asked: 09 Jan '16, 22:10

question was seen: 4,541 times

last updated: 10 Jan '16, 23:33

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum