Author Topic: .gpx File Splitter  (Read 1059 times)

zigzag

  • unfuckwithable
.gpx File Splitter
« on: March 04, 2019, 03:49:34 pm »
i'd like to split the gpx file into smaller chunks, say 600k into 4-6 sections. the ideal scenario would be uploading the file onto a website, it then appears on google maps, i zoom in and mark several points on it (the route shows the distance from the start and from the last marked point). it then generates 4-6 seperate gpx files to download.
does such a website exist? i've searched online and could not find anything suitable.

JonB

  • Granny Ring ... Yes Please!
Re: .gpx File Splitter
« Reply #1 on: March 04, 2019, 04:05:13 pm »
Not a website, so apologies for not answering your question directly, but Garmin's Basecamp does exactly what you want. However, you have to download it to a PC and for the kind of precision you might be after you'd probably want to load an OSM map to use in it, both things straightforward and once set up the splitting (and joining) functions work very smoothly.

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: .gpx File Splitter
« Reply #2 on: March 04, 2019, 04:42:10 pm »
i'd like to split the gpx file into smaller chunks, say 600k into 4-6 sections. the ideal scenario would be uploading the file onto a website, it then appears on google maps, i zoom in and mark several points on it (the route shows the distance from the start and from the last marked point). it then generates 4-6 seperate gpx files to download.
does such a website exist? i've searched online and could not find anything suitable.

I usually use RWGPS but I think you might only be able to do what is asked if you have a subscription....  If that's the case I could chop it up for you?
Regards,

Joergen

telstarbox

  • Loving the lanes
Re: .gpx File Splitter
« Reply #3 on: March 04, 2019, 05:15:25 pm »
It's a bit of a bodge, but if you have a Strava account (or your 600km is a Strava recording in the first place) you can split it into two then export separate GPXs.
2017 - R500 ✅ | 2018 - R1000 ✅ | 2019 - ?

Re: .gpx File Splitter
« Reply #4 on: March 04, 2019, 06:13:10 pm »
Basecamp is simple and accurate.  You can zoom in to see individual trackpoints and choose exactly where to split.  Once I have the Garmin plugged in Basecamp will show the same map (because I haven't got it installed on the PC).

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: .gpx File Splitter
« Reply #5 on: March 04, 2019, 06:53:18 pm »
If for some reason Basecamp (or in my case, Mapsource its precursor) doesn't suit, then my first response is "just use a text editor".  However, what is the object of the exercise?  Is it to:
a) replace one very large file with 4 smaller ones each approximately 1/4 the size of the original?
b) define some specific locations X, Y, Z between A and B so that you have files for A->X, X->Y, Y->Z, Z->B.  ?
Other questions:
c) is the original a tracklog?  (ie, do we assume you don't want to lose any data, even if it's spurious)
d) does it matter if thare are overlaps at the joins?  (I think overlaps are often quite useful, certainly no real need to go to lengths to avoid them)

If it's (a) then Phil's Simple GPX will do a good job, with the caveat that there will be some (spurious) data loss (because that's what it aims to do - remove 'fluff').  That aside, you can set it to split a track into n pieces, and define the distance interval to do the split.  Opt for '1 metre accuracy' and retain timestamps and elevation, to minimise data loss.

If it's (b) then Basecamp is good (so I've heard, never experienced it myself as a satisfied Mapsource user).
If it's anything else but not (b) then it really is a remarkably simple job to do with a competent text editor, preferably one that shows you line numbers and can handle at least 3 files open simultaneously.
"This is a complex subject, with a need for more than one highlighter pen."

Kim

  • 2nd in the world
Re: .gpx File Splitter
« Reply #6 on: March 04, 2019, 07:00:01 pm »
It's a simple job in a text editor, as long as you can find the split point easily (eg. by looking at the timestamp, rather than by making sense of the coordinates), and your text editor isn't going to get worked up about large files.  If you need to find the split point by looking at a map, this rapidly becomes non-fun.
To ride the Windcheetah, first, you must embrace the cantilever...

Re: .gpx File Splitter
« Reply #7 on: March 04, 2019, 07:27:10 pm »
If for some reason Basecamp (or in my case, Mapsource its precursor) doesn't suit, then my first response is "just use a text editor".  However, what is the object of the exercise?  Is it to:
a) replace one very large file with 4 smaller ones each approximately 1/4 the size of the original?
b) define some specific locations X, Y, Z between A and B so that you have files for A->X, X->Y, Y->Z, Z->B.  ?
Other questions:
c) is the original a tracklog?  (ie, do we assume you don't want to lose any data, even if it's spurious)
d) does it matter if thare are overlaps at the joins?  (I think overlaps are often quite useful, certainly no real need to go to lengths to avoid them)

If it's (a) then Phil's Simple GPX will do a good job, with the caveat that there will be some (spurious) data loss (because that's what it aims to do - remove 'fluff').  That aside, you can set it to split a track into n pieces, and define the distance interval to do the split.  Opt for '1 metre accuracy' and retain timestamps and elevation, to minimise data loss.

If it's (b) then Basecamp is good (so I've heard, never experienced it myself as a satisfied Mapsource user).
If it's anything else but not (b) then it really is a remarkably simple job to do with a competent text editor, preferably one that shows you line numbers and can handle at least 3 files open simultaneously.

It can also split a track by waypoints if they are defined in the file.  When splitting by distance you just select a distance from the drop down, you do not select the number of splits, the latter is automatic based on length of your track. Personally I would not split a 600 unless it has lots of overlap and you want to be sure which way to go where it crosses itself.

zigzag

  • unfuckwithable
Re: .gpx File Splitter
« Reply #8 on: March 04, 2019, 11:57:09 pm »
thanks for the replies. i have a basecamp installed on my windows laptop (which i use for the indoor training), but not the other laptop which runs on linux (and not compatible with the basecamp). web based solution would be preferable. i still haven't got my head around basecamp as i've only used it few times before.

my use case:
if i download or create a longer (100km+) course/track and upload it to "garmin connect" app, it automatically filters said course to ~500 track points. this resolution is fine for the shorter courses, but the longer ones look like they are made from long straight lines (which perhaps suits better for the usa than meandering roads of europe). therefore i'd like to split the long course into shorter ones before uploading them onto "garmin connect" and sending to the gps unit via bluetooth. web based gpx splitter would allow me to tinker with the files using anyone else's pc when i'm not at home.

Re: .gpx File Splitter
« Reply #9 on: March 05, 2019, 12:49:28 am »
gpxeditor.co.uk can do this. Upload a file, right click on where you want to split it and choose "This track:" > "Edit:" > "Cut to end" and then "This track:" > "Save just this" to make a GPX of the truncated track. Repeat as necessary for each chunk.

(annoyingly the site has a "Split" option in the menu which looks like it'll do what you want more directly, but is useless because it splits the track into track segments, and there's no way to export just one track segment)

Re: .gpx File Splitter
« Reply #10 on: March 05, 2019, 07:51:15 am »
(annoyingly the site has a "Split" option in the menu which looks like it'll do what you want more directly, but is useless because it splits the track into track segments, and there's no way to export just one track segment)

There's a "split into 2 tracks" function in the paid for version (£20 pa IIRC), that would do the job exactly as per zigzag's request.

zigzag

  • unfuckwithable
Re: .gpx File Splitter
« Reply #11 on: March 05, 2019, 08:47:40 am »
(annoyingly the site has a "Split" option in the menu which looks like it'll do what you want more directly, but is useless because it splits the track into track segments, and there's no way to export just one track segment)

There's a "split into 2 tracks" function in the paid for version (£20 pa IIRC), that would do the job exactly as per zigzag's request.

could i freely choose at which locations to split the file? could it be split into more than two tracks at a time?

Re: .gpx File Splitter
« Reply #12 on: March 05, 2019, 09:43:27 am »
Yes - I do this with it all the time for comedy off-roading where it's easier to recombine segments of tracks than try to use routing algorithms or to hand draw stuff.

Load up the track you want to split:



Right click at the point you want to split it and select menu option to split into 2 tracks:




Fudgey step to get the cursor back to the one you want:




Same for a second point:



The tracks are listed at the right hand side.

Changing colour of tracks for clarity:







Right click on track on right hand side (rename first maybe) and save it out as a gpx:




jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: .gpx File Splitter
« Reply #13 on: March 05, 2019, 09:57:51 am »
Just chucking in the view of another paid for solution if that's where you are heading.  RWGPS, select section and save it as a new route, if its 4 100km sections, then select the 100km, save as, move the 100km, save as etc... then you have each of your split routes as new routes, and the saving to a format for your GPS is a trivial exercise.

ETA: $50pa

Regards,

Joergen

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: .gpx File Splitter
« Reply #14 on: March 05, 2019, 12:06:09 pm »
But none of the above really helps since the object is to split by 500-point chunks, not by distance.  So that uploading to Connect doesn't downsample.

The distance equivalent of 500 points varies hugely depending on how the track was generated in the first place.  For what you want, I would recommend Phil's tool.  That will reduce point count very intelligently, and optionally split as well.  Any further downsampling by Connect after that would be negligible.
"This is a complex subject, with a need for more than one highlighter pen."

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: .gpx File Splitter
« Reply #15 on: March 05, 2019, 12:19:16 pm »
But none of the above really helps since the object is to split by 500-point chunks, not by distance.  So that uploading to Connect doesn't downsample.

The distance equivalent of 500 points varies hugely depending on how the track was generated in the first place.  For what you want, I would recommend Phil's tool.  That will reduce point count very intelligently, and optionally split as well.  Any further downsampling by Connect after that would be negligible.

When you save the file out of RWGPS, you have the option to down sample.

I've just exported a 300km ride from RWGPS at full fat setting and loaded it into Garmin Connect.  It went in without any degradation.  I know this file is over the number of track points because if I load it on to my Garmin, it tells me.  I've just sent the course from Garmin Connect over bluetooth and it loads fine, so there must be some re-sampling going on through that method... route appears to be as per original looking through the route on the Garmin's map.

This is with an Edge 1030 not sure which device zigzag is using?

As per my original offer - I'm happy to experiment on their behalf....
Regards,

Joergen

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: .gpx File Splitter
« Reply #16 on: March 05, 2019, 12:43:48 pm »
The only Garmin devices still in circulation with a 500-point limit are old-style Etrexes (Legend, Vista) or other models of pre-2006 sort of vintage - and they don't do any kind of bluetooth or NFC shenanegans.  So yes, there's something odd with the OP's workflow.
"This is a complex subject, with a need for more than one highlighter pen."

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: .gpx File Splitter
« Reply #17 on: March 05, 2019, 12:50:40 pm »
The only Garmin devices still in circulation with a 500-point limit are old-style Etrexes (Legend, Vista) or other models of pre-2006 sort of vintage.

My understanding was it was with reference to a 500 point limit uploading to the Garmin Connect app?

The limit I experience with the file I used above was the 200 track point limitation on all Edge devices.  I don't know if that is linked to the '500 point limit'  Notwithstanding that, the 300km and subsequent 612km file I created after the above post both load in to Garmin Connect app without degradation that I can see and then transfer to my GPS device without error when the course is loaded.  Perhaps it's something to do with how RWGPS saves a GPX (it is renowned for 'bloat') compared with the source of zigzag's file...?

ETA:
RWGPS Course: https://ridewithgps.com/routes/29432022
GC 600km course https://connect.garmin.com/modern/course/22818674

If I download the resulting GPX from GC and compare within RWGPS, there is no difference in the route on the map. (2km difference in distance is not unusual for a RWGPS with cue points compared to a GPX uploaded without)
Regards,

Joergen

frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: .gpx File Splitter
« Reply #18 on: March 05, 2019, 12:59:18 pm »
I think there must be some wires crossed here.  Edges can handle thousands of track points.  There would be lower limits on Route points or Waypoints.  I have no knowledge of what Connect offers.  Planner sites like BikeHike and maybe RWGPS easily offer a 'Route' file for download rather than a 'Track' file - both are GPX so it's not always obvious which you are working with - and in discussions the words 'route' and 'track' are often interchanged leading to (my) confusion.

A 'Course' would not be a GPX file - it would be a TCX.  It contains elements that are not part of the GPX standard.
"This is a complex subject, with a need for more than one highlighter pen."

jiberjaber

  • ... Fancy Pants \o/ ...
  • ACME S&M^2
Re: .gpx File Splitter
« Reply #19 on: March 05, 2019, 01:09:54 pm »
I think there must be some wires crossed here.  Edges can handle thousands of track points.  There would be lower limits on Route points or Waypoints.  I have no knowledge of what Connect offers.  Planner sites like BikeHike and maybe RWGPS easily offer a 'Route' file for download rather than a 'Track' file - both are GPX so it's not always obvious which you are working with - and in discussions the words 'route' and 'track' are often interchanged leading to (my) confusion.

A 'Course' would not be a GPX file - it would be a TCX.  It contains elements that are not part of the GPX standard.

There's further confusion out there  :facepalm:  RWGPS offer the following:

FIT - seems to be like a TCX but smaller in file size
TCX Course - Provides turn by turn directions including custom cue entries, but may consume more space than FIT.
GPX Track - just the track points, no cue information also has options to include additional information (POI & cue) as waypoints and an option to reduce to 500 points
GPX Route - "Only the cuesheet entries, not the entire track. Not useful for most, you most likely want a GPX Track."
plus others such as a CSV cue sheet, a Google Earth KML etc.

https://ridewithgps.com/help/export-file-formats

Prior to the FIT option, I used TCX as I don not use the built in turn-by-turn of the Garmin due to it deciding to route sometimes different to teh actual route... not very Audax friendly!
Regards,

Joergen

Re: .gpx File Splitter
« Reply #20 on: March 05, 2019, 01:59:27 pm »
FIT - seems to be like a TCX but smaller in file size

They've vastly different:-
* TCX is just verbose XML
* FIT is a dense binary format that Garmin uses for all files (config files, courses, history logging, workouts, 24/7 HR logging, ... everything on the device).

If you read zigzag's posts you'll see that it is the Garmin Connect website (which he uploads his routes to) which is downsampling uploaded routes to 500 points.

Given this limitation he wants to split a route like a 600km into 4-6 chunks so that the effect of the downsampling is lessened.

He doesn't want to just cut the existing route into chunks of 500 points each. He wants to see on a map where he can split it into chunks and then assume that Garmin Connect will do its work after that. The routes will probably be a lot more usable if they are split at particular points (e.g. controls or designated stops) rather than randomly based on point count.
"Yes please" said Squirrel "biscuits are our favourite things."

zigzag

  • unfuckwithable
Re: .gpx File Splitter
« Reply #21 on: March 05, 2019, 02:03:54 pm »
regarding the file size/resolution - when you select the model of the head unit in "garmin connect" app, it automatically filters (or not) the whole course according to the head unit. in my case, edge 130, supports ~500* trackpoints per course; higher end units might support much more**. i can upload any size file to "garmin connect", but what is then sent to my unit is downsampled to a fairly low resolution. so i'd rather upload shorter courses to start with, so that the outcome is still with usable resolution.

* i've asked garmin about this, but they wouldn't respond
** has anyone tried with the 520 or 1030 to upload e.g. lejog route as a single file and see if the course closely follows the road?

zigzag

  • unfuckwithable
Re: .gpx File Splitter
« Reply #22 on: March 05, 2019, 02:06:54 pm »
If you read zigzag's posts you'll see that it is the Garmin Connect website (which he uploads his routes to) which is downsampling uploaded routes to 500 points.

Given this limitation he wants to split a route like a 600km into 4-6 chunks so that the effect of the downsampling is lessened.

He doesn't want to just cut the existing route into chunks of 500 points each. He wants to see on a map where he can split it into chunks and then assume that Garmin Connect will do its work after that. The routes will probably be a lot more usable if they are split at particular points (e.g. controls or designated stops) rather than randomly based on point count.

exactly that, thank you :thumbsup:

Feanor

  • It's mostly downhill from here.
Re: .gpx File Splitter
« Reply #23 on: March 05, 2019, 02:09:45 pm »
I've never seen GarminConnect downsampling any of my uploaded tracklogs to 500 points.
Not sure what that's all about.

It does seem to downsample somewhat for display purposes, so zooming in on the map it looks 'coarser' on the new 'Modern' website than it did on the 'old' website, but the entire tracklog is still there and can be downloaded etc.

zigzag

  • unfuckwithable
Re: .gpx File Splitter
« Reply #24 on: March 05, 2019, 02:41:34 pm »
I've never seen GarminConnect downsampling any of my uploaded tracklogs to 500 points.
Not sure what that's all about.

It does seem to downsample somewhat for display purposes, so zooming in on the map it looks 'coarser' on the new 'Modern' website than it did on the 'old' website, but the entire tracklog is still there and can be downloaded etc.

maybe it's unit dependent? i can also see the course in hi-res on the website or mobile app it seems to be downsampled only when sent to the edge 130. i suspect this might be due to some silly memory limitation, similar to 100h of history kept in the memory.