software to split GPX into 500point sections

Talk about anything.

Moderators: Bearbonesnorm, Taylor, Chew

Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

software to split GPX into 500point sections

Post by Asposium »

My Garmin inReach only has the ability for 500point tracks (rubbish I know :o )

One work around I thought of was to split a larger GPX into 500point sections

Route-1
Route-2
Route-3
etc

Anyone know of a program that will split a large GPX into these 500point segment?

Doing a quick google came across a few, wondering people have a preference for one.

Ta
ianfitz
Posts: 3642
Joined: Thu Jan 24, 2013 1:33 pm

Re: software to split GPX into 500point sections

Post by ianfitz »

Pretty sure you can do that on bikehike
Image
Chew
Posts: 2602
Joined: Sun Jun 19, 2011 8:46 pm
Location: Halifax

Re: software to split GPX into 500point sections

Post by Chew »

You can merge tracks and reduce the number of points in BikeHike, but unsure you can split them (I could be wrong)

If you can read a bit of code, its easy enough to do manually :geek:
If you open the file in Notepad it will show you the file. It starts off with some header info around unit/name etc... The actual route will start with
<trkseg>

After that its just all of the gps points
<trkpt lat="54.336800000000004" lon="-2.57392"> <ele>158.74</ele> </trkpt>

These then repeat until you get to
</trkseg>

Then theres a bit at the end.

You can just copy the files a few times and then delete an appropriate number of gps points to get you down to the required file size
chris n
Posts: 608
Joined: Fri Nov 18, 2011 10:38 am

Re: software to split GPX into 500point sections

Post by chris n »

Bikehike will do it. Load the full track and use the cut to end and reverse route functions to trim bits off the start/end/both. Then use Trackpoint Reduction in the Options to reduce them to 500 pt segments. You'll need to save each bit out separately, and reload the full track to create the next segment. A bit of experimentation will be needed to work out what the maximum length a 500 pt track can be and still give you a usable track to follow.
User avatar
Dave Barter
Posts: 3630
Joined: Sun Jun 16, 2013 6:21 pm

Re: software to split GPX into 500point sections

Post by Dave Barter »

GPS Babel is what you need

https://www.gpsbabel.org/
Elite keyboard warrior, DNF'er, Swearer
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

Dave Barter wrote:GPS Babel is what you need

https://www.gpsbabel.org/
downloaded and installed
not user friendly
User avatar
Dave Barter
Posts: 3630
Joined: Sun Jun 16, 2013 6:21 pm

Re: software to split GPX into 500point sections

Post by Dave Barter »

It is an incredibly powerful toolkit, it will not have a "oh so you wanted to split a track into sections of 500 points" option unfortunately. But it will do almost anything you can imagine you need to do with a GPX file or other GPS data.

For those of us who know GIS it is dead straightforward. If you're still stuck just send me the file and I'll do it. I'm much more user friendly.
Elite keyboard warrior, DNF'er, Swearer
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

Dave Barter wrote:It is an incredibly powerful toolkit, it will not have a "oh so you wanted to split a track into sections of 500 points" option unfortunately. But it will do almost anything you can imagine you need to do with a GPX file or other GPS data.

For those of us who know GIS it is dead straightforward. If you're still stuck just send me the file and I'll do it. I'm much more user friendly.
could you tell me the command line?

or perhaps split a GPX and screen capture the screen.

thanks for your help
ScotRoutes
Posts: 8144
Joined: Mon Mar 18, 2013 9:56 am

Re: software to split GPX into 500point sections

Post by ScotRoutes »

Basecamp

Load the whole track
Use the scissor tool to cut it into chunks.
Rename each one to what you want.
User avatar
Dave Barter
Posts: 3630
Joined: Sun Jun 16, 2013 6:21 pm

Re: software to split GPX into 500point sections

Post by Dave Barter »

Basecamp option will not necessarily reduce points to < 500

Can you tell me whether GPX is track or route points? Do you know if it is split into track segments already? This makes a difference to the command line I will work out for you.

This will get it down to less than 500 points as one track but will simplify it

gpsbabel -i gpx -f INPUT.gpx -x simplify,count=499 -o gpx -F OUTPUT.gpx
Elite keyboard warrior, DNF'er, Swearer
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

Dave Barter wrote:Basecamp option will not necessarily reduce points to < 500

Can you tell me whether GPX is track or route points? Do you know if it is split into track segments already? This makes a difference to the command line I will work out for you.

This will get it down to less than 500 points as one track but will simplify it

gpsbabel -i gpx -f INPUT.gpx -x simplify,count=499 -o gpx -F OUTPUT.gpx
the GPX is a single track

I wish to keep the detail, merely chop the GPX into segments of 500+N points, where N is the remainder and less than 500
User avatar
Dave Barter
Posts: 3630
Joined: Sun Jun 16, 2013 6:21 pm

Re: software to split GPX into 500point sections

Post by Dave Barter »

OK brace yourself ;-)

First convert the file to CSV

gpsbabel -i gpx -f INPUT.gpx -t -o csv -F OUTPUT.gpx

Next split this CSV into N files of 500 lines each (if you are on Mac or linux you can use split)

Finally convert each file back to GPX

gpsbabel -i csv -f FILE1.csv -t -o gpx -F GPX1.gpx

Should have sent it to me ;-)
Elite keyboard warrior, DNF'er, Swearer
ScotRoutes
Posts: 8144
Joined: Mon Mar 18, 2013 9:56 am

Re: software to split GPX into 500point sections

Post by ScotRoutes »

Dave Barter wrote:Basecamp option will not necessarily reduce points to < 500
It will if you cut it at the 500th way point. You'd also have the option of splitting it somewhere convenient rather than a random point in the route.
Last edited by ScotRoutes on Thu Jun 08, 2017 10:38 pm, edited 1 time in total.
User avatar
Dave Barter
Posts: 3630
Joined: Sun Jun 16, 2013 6:21 pm

Re: software to split GPX into 500point sections

Post by Dave Barter »

True but don't you have to maintain a count in the list box by hand? I'm not convinced it is easy.
Elite keyboard warrior, DNF'er, Swearer
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

Dave Barter wrote:OK brace yourself ;-)

First convert the file to CSV

gpsbabel -i gpx -f INPUT.gpx -t -o csv -F OUTPUT.gpx

Next split this CSV into N files of 500 lines each (if you are on Mac or linux you can use split)

Finally convert each file back to GPX

gpsbabel -i csv -f FILE1.csv -t -o gpx -F GPX1.gpx

Should have sent it to me ;-)
:o

my usual way might be easier
duplicate X times in basecamp
then delete as required to have 500 points per segment
thought there must be a better way
ScotRoutes
Posts: 8144
Joined: Mon Mar 18, 2013 9:56 am

Re: software to split GPX into 500point sections

Post by ScotRoutes »

Why duplicate it X times?
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

ScotRoutes wrote:Why duplicate it X times?
xxxxx...........................
.....xxxxx......................
..........xxxxx..................
...............xxxxx..............

duplicate because I am deleting the unneeded points
is there a more efficient way?
bearlymoving
Posts: 172
Joined: Mon Aug 24, 2015 9:42 am

Re: software to split GPX into 500point sections

Post by bearlymoving »

Asposium wrote:
ScotRoutes wrote:Why duplicate it X times?
xxxxx...........................
.....xxxxx......................
..........xxxxx..................
...............xxxxx..............

duplicate because I am deleting the unneeded points
is there a more efficient way?
Are you not keen on the command line at all?

If using it is an option, we might be able to take Dave's commands and wrap them up into a script.

Then you could just type "split-gpx-track route.gpx" and it would create a bunch of files for you with no more than 500 points in.

But there's probably no milage in that if you'd rather avoid the command line entirely.
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

gma wrote:
Asposium wrote:
ScotRoutes wrote:Why duplicate it X times?
xxxxx...........................
.....xxxxx......................
..........xxxxx..................
...............xxxxx..............

duplicate because I am deleting the unneeded points
is there a more efficient way?
Are you not keen on the command line at all?

If using it is an option, we might be able to take Dave's commands and wrap them up into a script.

Then you could just type "split-gpx-track route.gpx" and it would create a bunch of files for you with no more than 500 points in.

But there's probably no milage in that if you'd rather avoid the command line entirely.
not at all, I suppose I was just hoping there would be a nice simple way.

the command line approach will work just fine
just needs a bit more learning at the start

a lot less faff in the long run.
unless garmin remove the 500 point limitation, silly design.
ScotRoutes
Posts: 8144
Joined: Mon Mar 18, 2013 9:56 am

Re: software to split GPX into 500point sections

Post by ScotRoutes »

Asposium wrote:
ScotRoutes wrote:Why duplicate it X times?
xxxxx...........................
.....xxxxx......................
..........xxxxx..................
...............xxxxx..............

duplicate because I am deleting the unneeded points
is there a more efficient way?
When you split it - using the scissor tool - the first time, you'll have a track with 500 points and another with however many are left.
So, with a track of 2,600 points...

Cut it at 500. You've now two tracks - one of 500 and one of 2,100.
Split the big one into two.
You've now two at 500 and one at 1,600
etc
etc
etc

As I said, you could choose to cut it at somewhere sensible like a junction, cafe etc as you'll have the mapping on display as you're editing it.
bearlymoving
Posts: 172
Joined: Mon Aug 24, 2015 9:42 am

Re: software to split GPX into 500point sections

Post by bearlymoving »

Asposium wrote:the command line approach will work just fine
just needs a bit more learning at the start
Are you on a Mac? I just wrote a script to automate Dave's commands, but it'll only work on a Mac (it'll work on Linux too in principle, but I've not tested it):

https://raw.githubusercontent.com/gma/g ... -gpx-track

Save that file to disk (Command+S in your browser) and call it "split-gpx-track" (you might need to trim off a .txt extension).

Then open a terminal, find the file you just saved (with the cd command), and then type "chmod +x split-gpx-track" (that'll make it executable).

Now, when you're still in that directory, you'll be able to run it. Type the name of your large GPX file as an argument to the script, and it should do the rest.

This is what you can expect to see if it worked:

$ ./split-gpx-track 'Home from Macc.gpx'
Creating 'Home from Macc-1.gpx'
Creating 'Home from Macc-2.gpx'
Creating 'Home from Macc-3.gpx'
Creating 'Home from Macc-4.gpx'

By the way Dave, nifty approach. :-bd

Any trouble getting it to work, feel free to PM me (copy and paste all the text from your terminal into your message).
Last edited by bearlymoving on Fri Jun 09, 2017 10:30 am, edited 1 time in total.
User avatar
Bearbonesnorm
Posts: 23983
Joined: Sun Jun 05, 2011 8:53 pm
Location: my own little world

Re: software to split GPX into 500point sections

Post by Bearbonesnorm »

I started reading all ^ that but got lost / confused and thought, surely buying a gps that actually does what you want, would be a simpler approach :wink:
May the bridges you burn light your way
Asposium
Posts: 1632
Joined: Fri Jul 01, 2016 5:39 pm
Location: Southampton

Re: software to split GPX into 500point sections

Post by Asposium »

Bearbonesnorm wrote:I started reading all ^ that but got lost / confused and thought, surely buying a gps that actually does what you want, would be a simpler approach :wink:
the above is for my Garmin inReach (tracker)

no issue for the Garmin GPS

amazed Garmin would limit the points to 500 points
User avatar
Bearbonesnorm
Posts: 23983
Joined: Sun Jun 05, 2011 8:53 pm
Location: my own little world

Re: software to split GPX into 500point sections

Post by Bearbonesnorm »

the above is for my Garmin inReach (tracker)

no issue for the Garmin GPS

amazed Garmin would limit the points to 500 points
Any reason to buy that over a SPOT?
May the bridges you burn light your way
User avatar
whitestone
Posts: 7913
Joined: Thu Dec 04, 2014 10:20 am
Location: Skipton(ish)
Contact:

Re: software to split GPX into 500point sections

Post by whitestone »

Bearbonesnorm wrote:
the above is for my Garmin inReach (tracker)

no issue for the Garmin GPS

amazed Garmin would limit the points to 500 points
Any reason to buy that over a SPOT?
I believe that with the Delorme/Garmin you can purchase a month's subscription as and when you want rather than a full year as with SPOT
Better weight than wisdom, a traveller cannot carry
Post Reply