Author Topic: GPX files auto numbering of points?  (Read 2375 times)

GPX files auto numbering of points?
« on: 26 January, 2019, 01:18:00 pm »
I create gpx files using a variety of planning apps.

Configured so that just the turns are marked, which I then ride through as "off road" straight lines.

I use a text editor to trim the files to just be a series of co-ordinates with a following name.

eg:

    <rtept lat="53.94500" lon="-2.52178">
      <name>throughroa</name>

That name is supplied by the planner - in that case just a truncated version of "throughroad".

I then change all of these names so that they are numbered - helps me to find my way to a further-on point if I wander off road for any reason.

The format for instance for a London to Brighton route would be

LB01
LB02
LB03

or, if there are more than 100 points:

LB001
LB002
LB003


I have to do all of this manually using an offline text editor which is clearly a bit of a fag.

Question - is there a simple program (would have to work on a chromebook or be usable from a web page) which would automate this?

ie, I just tell the thing to replace everything it finds within:

<name>*****</name>
by a common prefix I define, eg LB, followed by a sequential unique number for each?

I have the idea that I used to be able to do this using
http://www.gpsvisualizer.com/convert_input

but must have imagined it.



FifeingEejit

  • Not Small
Re: GPX files auto numbering of points?
« Reply #1 on: 26 January, 2019, 03:32:33 pm »
I was thinking about brushing up on my XPath as about 90% of the GPX files I send with my DIY rides is basically useless for the purpose (Do AUK really want Wheel Speed, HR, Cadence, Temperature, and from some people power too, I'd assume not).

And I may as well figure out the FIT API at the same time to save needing to extract the data from Strava.
In theory what you're asking for should be pretty simple...

Was going to do it as a JavaFX app though, and I don't have anywhere online to host it so no real use for a chromebook.

Re: GPX files auto numbering of points?
« Reply #2 on: 27 January, 2019, 11:16:56 am »
Ah, Chromebook, should have access to a shell and awk/sed and possibly even perl. It should be quite easy.

Can you paste the first 50 lines or so of an example GPX file (inside code tags here) and I'll see if I can knock something up for you.

And I may as well figure out the FIT API at the same time to save needing to extract the data from Strava.

The FIT file format is quite a bit different from just using XPath or some other XML parser. Reading FIT files is quite involved, most of the time it's just easier to use a tool like fit2tcx to convert it to XML and go from there.

(I've got my own FIT file dumper that I'm playing with to automatically process my own files and pulling out the running/cycling/swimming stats I want. Don't get enough time to work on it though.)
"Yes please" said Squirrel "biscuits are our favourite things."

FifeingEejit

  • Not Small
Re: GPX files auto numbering of points?
« Reply #3 on: 27 January, 2019, 12:34:29 pm »
I've had the FIT API downloaded for some time as I'm interested in playing with it but never quite got started working on something with it.

The biggest blocker I've had to writing stuff for years is it being too much like work, but right now and for the foreseeable I'm working on stuff that's basically junk so the impetus to do my own development projects is increasing.


Re: GPX files auto numbering of points?
« Reply #4 on: 27 January, 2019, 09:13:01 pm »
Ah, Chromebook, should have access to a shell and awk/sed and possibly even perl. It should be quite easy.

Can you paste the first 50 lines or so of an example GPX file (inside code tags here) and I'll see if I can knock something up for you.

And I may as well figure out the FIT API at the same time to save needing to extract the data from Strava.

The FIT file format is quite a bit different from just using XPath or some other XML parser. Reading FIT files is quite involved, most of the time it's just easier to use a tool like fit2tcx to convert it to XML and go from there.

(I've got my own FIT file dumper that I'm playing with to automatically process my own files and pulling out the running/cycling/swimming stats I want. Don't get enough time to work on it though.)

Hi Greenbank.

Very kind of you.

You mean with a view to creating some sort of prog which I could use repeatedly in the future?

Can you explain what you mean by:


>> (inside code tags here)

?

I don't pretend to understand much of the rest of your post :) though the curious thing is that, many many moons ago, I have a vague memory of writing something in DOS to do something very similar - ie adding incremental numbers to a self defined prefix.

Or, rather than pasting something in here, if you trust me, pm me your email address, and I will send you an example gpx.

all the best


FifeingEejit

  • Not Small
Re: GPX files auto numbering of points?
« Reply #5 on: 27 January, 2019, 10:29:55 pm »
Sorry I've taken it a tad off topic!
I'm working with tracks rather than routes too.


Re: GPX files auto numbering of points?
« Reply #6 on: 28 January, 2019, 08:28:23 am »
I had meant the code tags that appear when you press the # button (below the Font Size box) when replying to a message on here.

Or, rather than pasting something in here, if you trust me, pm me your email address, and I will send you an example gpx.

Will do.
"Yes please" said Squirrel "biscuits are our favourite things."

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: GPX files auto numbering of points?
« Reply #7 on: 01 February, 2019, 11:37:40 am »
I was thinking about brushing up on my XPath as about 90% of the GPX files I send with my DIY rides is basically useless for the purpose (Do AUK really want Wheel Speed, HR, Cadence, Temperature, and from some people power too, I'd assume not).

To quote from aukweb's own page on the topic (my bold):
Quote
Your file containing the riddden tracklog that you upload after the ride should be no more than 1000kb (1mb).
Without zipping, that's about 8000 trackpoints to which time and elevation data have been added, should be enough for a 300km tracklog.
If extra data like temperature, power, or heart rate, are recorded then fewer trackpoints will hit the 1000kb limit.
It is also depressingly easy to create HUGE files by increasing the frequency with which trackpoints are recorded.
https://www.aukweb.net/resources/filesize/

AUK only needs position, timestamp and elevation information.
However if you upload as FIT the uploader uses fit2tcx to convert it, and that strips most of the fluff out anyway.  Unfortunately fit2tcx cannot handle FIT2 files which are typical of several newer GPSs  You need to convert those yourself and then ideally zip before upload, or run them through Phil's optimiser if you need to get the size down
when you're dead you're done, so let the good times roll

Re: GPX files auto numbering of points?
« Reply #8 on: 01 February, 2019, 12:17:01 pm »
Hi Greenbank

send you a file by email a while ago.

Trust you got it.

Re: GPX files auto numbering of points?
« Reply #9 on: 01 February, 2019, 12:31:19 pm »
Yes, sorry, just busy with work things. Hopefully look at it this evening.
"Yes please" said Squirrel "biscuits are our favourite things."

Re: GPX files auto numbering of points?
« Reply #10 on: 01 February, 2019, 12:37:09 pm »
No probs greenbank.

No rush - any post here about a breakthrough and I will see it.

all the best

FifeingEejit

  • Not Small
Re: GPX files auto numbering of points?
« Reply #11 on: 01 February, 2019, 02:41:57 pm »
I was thinking about brushing up on my XPath as about 90% of the GPX files I send with my DIY rides is basically useless for the purpose (Do AUK really want Wheel Speed, HR, Cadence, Temperature, and from some people power too, I'd assume not).

To quote from aukweb's own page on the topic (my bold):
Quote
Your file containing the riddden tracklog that you upload after the ride should be no more than 1000kb (1mb).
Without zipping, that's about 8000 trackpoints to which time and elevation data have been added, should be enough for a 300km tracklog.
If extra data like temperature, power, or heart rate, are recorded then fewer trackpoints will hit the 1000kb limit.
It is also depressingly easy to create HUGE files by increasing the frequency with which trackpoints are recorded.
https://www.aukweb.net/resources/filesize/

AUK only needs position, timestamp and elevation information.
However if you upload as FIT the uploader uses fit2tcx to convert it, and that strips most of the fluff out anyway.  Unfortunately fit2tcx cannot handle FIT2 files which are typical of several newer GPSs  You need to convert those yourself and then ideally zip before upload, or run them through Phil's optimiser if you need to get the size down

thanks, it's really just something for me to keep my Java development up on while we do loads of legacy ColdFusion work at work...
I also quite fancy playing with calculations on GPS locations too...

Despite all that CF work I'm now i'm in a JAX-B XML dependency with  hell in Java so maybe not all outmoded doom and gloom.