Author Topic: How do I remove irrelevant data from a .gpx file?  (Read 5729 times)

How do I remove irrelevant data from a .gpx file?
« on: August 20, 2010, 12:22:56 pm »
Someone's asked me to supply a .gpx file for an Audax ride I did last year. I have a Garmin .gdb file comprising the download from my GPS unit after completing the ride. I know how to cut it up into sections of no more than 500 trackpoints but I'd also like to strip off the speed data (yes, embarrassingly slow!) to leave just the bare track or ideally the trackpoints with lat., long and altitude.

I've got TCX Converter but I can't figure out if it will do the above. Without getting too technical, if possible, is there a simple, reliable and quick way of doing this?

Mrs Pingu

  • Who ate all the pies? Me
    • Twitter
Re: How do I remove irrelevant data from a .gpx file?
« Reply #1 on: August 20, 2010, 12:32:05 pm »
I don't know if this is any use to you, but this is what I use to convert my Google My Tracks gpx files which contain squillions of points into something with less than 500 so I can put it on bikely. I don't know if it keeps the speed or not...
http://www.coursemapper.com/coursecompacter.htm
Do not clench. It only makes it worse.

fuaran

  • rothair gasta
Re: How do I remove irrelevant data from a .gpx file?
« Reply #2 on: August 20, 2010, 05:21:47 pm »
You could open the GPX file in a text editor, then do a find and replace for the <time> tags (and anything within them).

Re: How do I remove irrelevant data from a .gpx file?
« Reply #3 on: August 20, 2010, 06:41:25 pm »
Thanks Mrs. P - I had a quick look at Coursemapper but I couldn't see a way of deleting just the gen I want rid of. I don't actually need to compact the course in terms of actual trackpoint numbers.

fuaran: ta for the tip, but .......... I'm not too cute with the digital ability - if I open the .gpx track file in say Word or Wordpad I can see all the <time> tags and the data in between them but... I don't know how to do a "Replace all" when each pair of tags contains different data - I assume I need a global "Replace <time>*<time> or similar ? (I tried this but it didn't work.)

simonp

  • Omnomnomnipotent.
Re: How do I remove irrelevant data from a .gpx file?
« Reply #4 on: August 20, 2010, 06:48:26 pm »
I would install sed, and use that.

fuaran

  • rothair gasta
Re: How do I remove irrelevant data from a .gpx file?
« Reply #5 on: August 20, 2010, 06:56:07 pm »
I wouldn't recommend Word or Wordpad as a text editor...

But if you want to use Word, you have to choose replace, then click on the option for "More", and tick the box for "use wildcards". Then search for something like this (note you have to escape the < and >):
Code: [Select]
\<time\>*\</time\>

Re: How do I remove irrelevant data from a .gpx file?
« Reply #6 on: August 20, 2010, 06:56:39 pm »
I would install sed, and use that.

"sed" ? Wossat?

mattc

  • n.b. have grown beard since photo taken
    • Didcot Audaxes
Re: How do I remove irrelevant data from a .gpx file?
« Reply #7 on: August 20, 2010, 07:05:21 pm »
"sed" ? Wossat?

It's a bit like Word, but lets you do more stuff like:

Code: [Select]
\<time\>*\</time\>
... but none of the stuff like fonts, or printing.

Oh, and it's cheaper.

Has never ridden RAAM
---------
No.11  Because of the great host of those who dislike the least appearance of "swank " when they travel the roads and lanes. - From Kuklos' 39 Articles

simonp

  • Omnomnomnipotent.
Re: How do I remove irrelevant data from a .gpx file?
« Reply #8 on: August 21, 2010, 01:24:05 am »
I certainly wouldn't try to use word as a text editor.

sed is a text processing tool that will do the search and replace, given the correct runes

Of course you have to do it in the command line.

something like this

sed -e 's/\<time\>.*\<\/time\>/' < input.gpx > output.gpx

If I wanted to do it in a text editor then there plenty that can do it.

What would be handy is a tcl app which you could give a gpx file and do this or other basic manipulations.


Re: How do I remove irrelevant data from a .gpx file?
« Reply #9 on: August 21, 2010, 06:18:22 am »
OK everyone, thanks. I've found "sed" on Wikipedia. But I'm deep in that familiar feeling of being just about to drown as the waters of knowledge lap menancingly up to my chin!

fuaran and Simonp say they wouldn't use Word as a text editor - is there an app out there that anyone would recommend for use by a simpleton who doesn't already have the expertise to edit HTML? I don't mind buying one, within reason, if necessary, but I feel that to get going with something like sed would take more time and brainpower than I can devote to this!

PaulF

  • "World's Scariest Barman"
  • It's only impossible if you stop to think about it
Re: How do I remove irrelevant data from a .gpx file?
« Reply #10 on: August 21, 2010, 07:47:49 am »
If all you want to do is to remove those elements I would use Word and search and replace as fuaran suggested. Word's not a great text editor but will do what you need.

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: How do I remove irrelevant data from a .gpx file?
« Reply #11 on: August 21, 2010, 08:58:22 am »
You could do it in Excel or similar.
In Mapsource save as .csv file.

Open in Excel (NB set all columns to 'text' not the default 'general')
Blank the data columns you don't want and re-save as csv

Then you do have the problem of converting it back to .gdb or .gpx - I would suggest GPSBabel for this, or its online alter ego, GPS Visualizer.
"This is a complex subject, with a need for more than one highlighter pen."

Re: How do I remove irrelevant data from a .gpx file?
« Reply #12 on: September 07, 2010, 01:27:08 pm »
Rather than Word, why not use Notepad? Simpler, quicker.
"A woman on a bicycle has all the world before her where to choose; she can go where she will, no man hindering." The Type-Writer Girl, 1897

Re: How do I remove irrelevant data from a .gpx file?
« Reply #13 on: September 07, 2010, 02:07:38 pm »
Unlike others, I would use word.

The search and replace option has an ability to use wildcards, as fuaran says
I wouldn't recommend Word or Wordpad as a text editor...

But if you want to use Word, you have to choose replace, then click on the option for "More", and tick the box for "use wildcards". Then search for something like this (note you have to escape the < and >):
Code: [Select]
\<time\>*\</time\>


Once edited you can save as a text file, which is a normal text file that can be renamed as .gpx (it's only if you save as a word document that you could have issues, saving as a pure text file will not add any rubbish to the file).

inc

Re: How do I remove irrelevant data from a .gpx file?
« Reply #14 on: September 07, 2010, 08:32:37 pm »
You should be able to use   www.gpsvisualizer.com/gpsbabel/      it is an online version of  gpsbabel,  put your .gdb in and get a .gpx out. Gpsbabel has more options but this looks like it will do what you want.

Re: How do I remove irrelevant data from a .gpx file?
« Reply #15 on: April 17, 2017, 05:32:34 pm »
A super ancient thread I know but I came across it via google, wanting to do the same thing.

If anyone is interested I've found a simple semi-automatic pretty fast way of achieving this using a chromebook offline.