Author Topic: Slitting gpx courses into smaller segments? Truncation cure??  (Read 2942 times)

bikey-mikey

  • AUK 6372
  • Yes, I am completely mad ! a.k.a. 333
On my Edge 800 I loaded the course I used for last year's Bryan Chapman Memorial (600), which worked fine last year, (until my accident).

I reloaded it for the weekend and it now comes up as 'truncated' which is something that has begun to happen very occasionally recently - possibly in one of the firmware updates they changed something?

So I want to take my existing array of gpx routes and split them down into smaller segments of maybe 200 kms, and most likely into files of around that length that start and end at controls.

I could do it the slow way by completely rewriting each section, but is there an easier way?

Can anybody properly explain 'truncation' as regards edge 800 ?
I’ve decided I’m not old. I’m 25 .....plus shipping and handling.

Cycling heatmap
https://www.strava.com/athletes/4628735/heatmaps/6ed5ab12#10/51.12782/-3.16388

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #1 on: 16 May, 2013, 08:39:19 am »
I am interested in the responses to this question.  I have an 800 and my latest 150km audax GPX track did not truncate even though there were more that 500 points so I am keen to know if there are any such parameters as with the Etrex series.
Cancer changes your outlook on life. Change yours before it changes you.

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #2 on: 16 May, 2013, 09:33:05 am »
Have a look at Tyre toTravel dotcom.

A GPX editor.

bikey-mikey

  • AUK 6372
  • Yes, I am completely mad ! a.k.a. 333
Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #3 on: 16 May, 2013, 10:16:08 am »
I had a long conversation with the tech support at Garmin.

Seems that the internal memory of the 800 is 100 Mb, of which about 75 Mb is available for storing activities and courses etc.  When you exceed this memory you get a 'truncated' message.

So I asked them what happened if you loaded the course onto the microSD card, (mine has 8 Gb of memory), & chose to save the activity to the card.  They said that they thought that would mean I had not used up the internal memory, so might not get the truncation message.

Previously I saved ride data on the card, so it was retrievable if the unit went kaput, but put the gpx course on internal memory, purely because when you look at stored courses on the 800, the space available for the name is pretty short, so you don't necessarily see all of it, which can be a problem if the end of the name tells you which variation of the file it is, e.g. one says fast route & one says scenic route.  For some reason courses stored on the SD card start with 'SD' & a space, so using up even more of the space available.

Garmin suggested that I update the software, which I have done, and that I perform a hard reset, which I have not done.

Anyway I reloaded the BCM 600 route onto the SD card and loaded it up, and NO TRUNCATION....

Please can somebody out there test this theory with an enormous file, maybe London Cardiff Edinburgh London or similar??
I’ve decided I’m not old. I’m 25 .....plus shipping and handling.

Cycling heatmap
https://www.strava.com/athletes/4628735/heatmaps/6ed5ab12#10/51.12782/-3.16388

Dave_C

  • Trying to get rid of my belly... and failing!
Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #4 on: 16 May, 2013, 10:45:14 am »
I had a similar?? problem with my gpx file of a recent 400. Mercurykev loaded the file into some web based app which reduces the number of points. I think the 500 number being banded about may be a hangover from the older eTrex H or Legends?? as I'm told my new eTrex20 has ~12000 points of capability.
@DaveCrampton < wot a twit.
http://veloviewer.com/athlete/421683/

bikey-mikey

  • AUK 6372
  • Yes, I am completely mad ! a.k.a. 333
Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #5 on: 16 May, 2013, 11:03:04 am »
I can only speak for the 800 & 810, and I think they have moved away from a fixed number of track points to an 'available memory' basis.

I wonder if all track points use the same amount of memory, and whether the 800 and 810 have variable size data within track points, making a pure 'number' of points not relevant?
I’ve decided I’m not old. I’m 25 .....plus shipping and handling.

Cycling heatmap
https://www.strava.com/athletes/4628735/heatmaps/6ed5ab12#10/51.12782/-3.16388

Phil W

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #6 on: 18 May, 2013, 09:28:20 pm »
Track points will have latitude and longitude which will be a fixed size plus elevation which will mostly be 2 or 3 digits, so not a lot of variance. If is a track log it may have a heart rate data, if you wear a chest band. Otherwise each track point will pretty much take up the same memory.

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #7 on: 19 May, 2013, 09:52:14 pm »
So I want to take my existing array of gpx routes and split them down into smaller segments of maybe 200 kms, and most likely into files of around that length that start and end at controls.
A gpx file is a plain text file that can be edited in notepad or whatever your preferred editor is.

The file for a track looks like this:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
 <trk>
  <name>ACTIVE LOG172431</name>
  <trkseg>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-77.964</ele>
    <time>2011-05-10T16:24:31Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.445</ele>
    <time>2011-05-10T16:24:33Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.403</ele>
    <time>2011-05-10T16:24:34Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.725</ele>
    <time>2011-05-10T16:24:40Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.847</ele>
    <time>2011-05-10T16:24:41Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.847</ele>
    <time>2011-05-10T16:24:42Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.207</ele>
    <time>2011-05-10T16:24:43Z</time>
   </trkpt>
  </trkseg>
 </trk>
</gpx>

To split it, you just have to open a copy of the file, and delete the points you don't want, taking care that you delete whole trackpoints (everything between "<trkpt>" and the next "</trkpt>", including the two tags just quoted.
Then take another copy of the original file, and delete the points you didn't delete in the first copy.

The following would be the first 4 of the 7 trackpoints in the above track
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
 <trk>
  <name>ACTIVE LOG172431</name>
  <trkseg>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-77.964</ele>
    <time>2011-05-10T16:24:31Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.445</ele>
    <time>2011-05-10T16:24:33Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.403</ele>
    <time>2011-05-10T16:24:34Z</time>
   </trkpt>
   <trkpt lat="51.861718" lon="-2.223100">
    <ele>-78.725</ele>
    <time>2011-05-10T16:24:40Z</time>
   </trkpt>
  </trkseg>
 </trk>
</gpx>

If you've got a route, you will have route tags (<rte>...</rte>), with a number of routepoints (<rtept>...</rtept>) or waypoints (<wpt>...</<wpt>). Again, you have to delete everything between the opening tag (eg "<rtept>") and the closing tag("</rtept>"), including the tags themselves.
Routes are easier in that waypoints and routepoints would generally have names, which makes it easier to split the gpx in the correct place.

The important thing is that every opening tag <xyz> has a matching closing tag </xyz>.

You can check this by renaming the file from xyz.gpx to xyz.xml, and then double-clicking it to open it in Internet Explorer. If everything is OK, you'll have no error messages, and each opening tag will have a "-" next to it that you can click on to collapse the tag and everything up to the matching closing tag to a single line with a "+" where the "-" was. You should be able to click the "-" next to the "<gpx...>" tag, and collapse the whole file to two lines (The gpx line and a header line similar to "<?xml version="1.0" encoding="UTF-8"?>".
If eveything is OK, rename the file back to xyx.gpx.

bikey-mikey

  • AUK 6372
  • Yes, I am completely mad ! a.k.a. 333
Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #8 on: 27 May, 2013, 08:34:27 am »
Thanks for the excellent explanation.

Looks good - first time I really ever understood this stuff.

If you have two gpx files that follow on, can you paste the tracks together using the same basic principle?
I’ve decided I’m not old. I’m 25 .....plus shipping and handling.

Cycling heatmap
https://www.strava.com/athletes/4628735/heatmaps/6ed5ab12#10/51.12782/-3.16388

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #9 on: 27 May, 2013, 05:16:42 pm »
While not in any way disagreeing with what AndrewS wrote, I do feel his approach is prone to error (as, I guess, does Andrew given his emphasis on the matching start and end tags).  When I want to split tracks into smaller segments, which is a frequent need as I use an older eTrex Vista, I use the splitting tool in Garmin Mapsource.  I imagine that Basecamp has something similar.  This enables the track to be split into shorter sections, and it is then easier (safer?) to work with those shorter sections as an entity, rather than identifying particular lines to delete.

It is also easy to reduce the trackpoints (whether to fit the eTrex limitations or the "available memory") at the same time.

Phil W

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #10 on: 29 May, 2013, 10:24:01 pm »
Thanks for the excellent explanation.

Looks good - first time I really ever understood this stuff.

If you have two gpx files that follow on, can you paste the tracks together using the same basic principle?

Yes but you need to select just the track points you want, not the whole gpx file contents.

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #11 on: 30 May, 2013, 10:00:30 am »
As with every computer system,,,

GI - GO.

And "Haste maketh waste."


Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #12 on: 30 May, 2013, 02:15:00 pm »
If you have two gpx files that follow on, can you paste the tracks together using the same basic principle?
Yes.
See this other topic where someone was asking about joining tracks that had been split by a mid-ride battery change.

Matching tags isn't generally difficult, except on the occasional gpx files that don't have any line feeds and are just a great long string. Errors are normally where the mouse slipped a row just as you clicked or auto-scroll took you too far down the file. I'd usually use winvi and delete by row number.

Re: Slitting gpx courses into smaller segments? Truncation cure??
« Reply #13 on: 31 May, 2013, 08:24:23 am »
Joining GPXs.

Open two instances of Tyre toTravel. Open the two GPXs, one in each.
Highlight the waypoints in the route you want to do first.  Press 'Alt & C'.
Click the mouse pointer in the Waypoint list of the other GPX and press 'Alt & V'. The Waypoints will be pasted BEFORE existing Waypoints.
Delete, add or move any waypoints so the route fits your requirements.

Save as a new named 'Garmin GP eXchange file'.

Splitting is a reverse operation.
Open two instances. One empty.
Highlight the Waypoints to move. Press 'Alt & X'.
Click the pointer in the empty Waypoint list on the other window and press 'Alt & V'. Done.