GPX File resolution
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

GPX File resolution

22 Posts
10 Users
4 Reactions
707 Views
Posts: 13594
Free Member
Topic starter
 

Anyone know anything about creating GPX files and using them in Garmins etc?

I'm mid way through writing a cycling club website, which stores GPX files. I've noticed that when I upload ones from my Polar bike computer, they're massive and super high resolution eg:

[url= https://live.staticflickr.com/65535/53021589126_fbdba5ce16_o.pn g" target="_blank">https://live.staticflickr.com/65535/53021589126_fbdba5ce16_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMkvcL ]gpx[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr

This seems a bit pointless, so I was thinking of trimming them down in intelligently, eg if we have 100 points in the same direction, just cull it to one or two along that path.

However, I was wondering if there is a minimum resolution necessary for Garmins etc to be able to follow the route. Eg if there was a dead straight road and I had just two points, say 2 miles apart, would a Garmin be happy with that?

EDIT: Just created a two point route in Strava, to see what the GPX looks like and it seems to have a minimum resolution (approx 100m).

[url= https://live.staticflickr.com/65535/53022081713_3daea6f996_o.pn g" target="_blank">https://live.staticflickr.com/65535/53022081713_3daea6f996_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMo2CD ]test2[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr


 
Posted : 04/07/2023 9:21 am
Posts: 5382
Free Member
 

I've always used  http://www.bikehike.co.uk/mapview.php to create a gxp and then manually upload it to my Garmin.

Either that or kamoot if I want ai to create a route for me.

Pretty sure you can upload and edit to bike hike too.


 
Posted : 04/07/2023 9:26 am
Posts: 12865
Free Member
 

literally not something I've ever even thought about before (probably because as above I usually follow routes I've planned myself & very rarely follow an actual recorded track.) But a quick google finds a number of free/open-source GPX optimisers which claim to intelligently reduce the number of points, so I'd just try one of those.


 
Posted : 04/07/2023 10:37 am
Posts: 43345
Full Member
 

Route or Track? 😉

If the unit is using Routable Maps then it's only necessary to have a gpx point at each change of road or track. The unit will follow any bends, corners on that road or track without the need for intermediate points. This means you can have a very small file. I could easily create a 50km Route with as few as 3 points.

A Track can be thought of as the gpx file you create while actually riding, so it will have a point every so many seconds (depending upon recording resolution). Some route planning software will give you the option to create either. The advantage of a Track is that it can also be used on non-routable maps. The disadvantage is that you end up with a very large file.


 
Posted : 04/07/2023 10:49 am
footflaps reacted
Posts: 13594
Free Member
Topic starter
 

Route or Track?

Just been reading about that on Wikipedia.

I think I'll just go with the resolution Strava produces, as I suspect they've chosen that intelligently.

But a quick google finds a number of free/open-source GPX optimisers which claim to intelligently reduce the number of points,

I don't think it will be very hard to write something, probably 20 line of Python to detect a change in direction and stick down a point etc.

Currently I let the user edit their GPX route to remove the bit at the start and end which might show where they live. Once they've done that I was going to process the whole thing to reduce the size of the file.


 
Posted : 04/07/2023 11:18 am
Posts: 43345
Full Member
 

Other than as an intellectual exercise, why create something from scratch at all? Most of the good gpx planners will hold a library of routes for you/your club and will handle the various flavours of device type. I just feel you're putting yourself in a position of maintaining this indefinitely, and then what happens when someone else takes on the job?


 
Posted : 04/07/2023 11:23 am
fasthaggis reacted
Posts: 13594
Free Member
Topic starter
 

Other than as an intellectual exercise,

Yep, that's 100% why I'm doing it.

I don't actual GAS if anyone uses it.

I've just been learning Python and need something real to practice on.

Although interestingly I've not seen another site which does exactly the same (not that it matters). I have a dB of cafes with details such as groups size suitability, indoor outdoor seating. So the route selection process is look at the wind direction for the day in question, pick a suitable cafe in the direction of the wind and the site then shows you all the possible routes which pass that cafe and you then pick a route from the selection and download that.

We have lots of people who can lead rides but only if someone gives them a GPX file, they seem incapable of just looking at their own Strava feed and downloading one from last year, say, which was good for a strong NE etc. So, I thought I'd just streamline the whole thing...

The idea is other people maintain it, you can register as a user and upload new cafes / gpx files, so anyone can effectively keep it up to date in terms of the data it holds.

But really, it's just something to code up for the sake of learning Python, Flask, Bootstrap, Docker and Google web hosting....


 
Posted : 04/07/2023 11:42 am
Posts: 43345
Full Member
 

In that case, crack on 😂


 
Posted : 04/07/2023 11:56 am
Posts: 8771
Full Member
 

When you say the GPX files are massive do you mean like a whole megabyte or something?

But interesting idea re wind & cafes 🙂


 
Posted : 04/07/2023 12:18 pm
Posts: 15261
Free Member
 

The "best" tool (IMO/IME) for creating, importing or editing routes is Garmin Basecamp but it is a steep learning Curve and its designed to cover everything you could possibly be doing with almost any type of GPS route/device.

The trick is filtering out the superfluous features and figuring out how to do the specific things you want with it (and there's almost always three different ways to do any task), hence I put "best" in quotes above.

It is well worth learning to use Basecamp, but clear a good chunk of your time to do it and watch a few YouTube tutorials if you are going to use it.


 
Posted : 04/07/2023 12:21 pm
leffeboy reacted
Posts: 214
Full Member
 

I suggest you look at GPSBabel  https://www.gpsbabel.org/capabilities.html This has a Simplify routes filter that should allow you to reduce the size of a track or route before you then upload it.  Also see https://www.gpsbabel.org/htmldoc-development/filter_simplify.html


 
Posted : 04/07/2023 12:45 pm
Posts: 13594
Free Member
Topic starter
 

When you say the GPX files are massive do you mean like a whole megabyte or something?

5 Mb for a 100k road ride.

Seems a bit excessive to me.


 
Posted : 04/07/2023 12:46 pm
Posts: 13594
Free Member
Topic starter
 

But interesting idea re wind & cafes

That's basically how everyone who leads rides works, the unwritten rule is tail wind on the return, so the process all starts with which direction the wind is in, then what cafe choices do we have and which one haven't we been to for a while, then once you have a cafe, design a decent route there and back.

It's really very simple (IMO), but most people don't seem able to manage it - or maybe they are scared of picking a 'bad' route and being criticised (not that anyone ever does that).

So,

Step 1: Look at wind (not in website, but easy to scrape BBC weather)

Step 2: Pick a cafe

[url= https://live.staticflickr.com/65535/53022263545_c96bbac4ee_o.pn g" target="_blank">https://live.staticflickr.com/65535/53022263545_c96bbac4ee_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMoXFF ]cafes[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr

Each pin is a hyperlink, so click through to cafe page
[url= https://live.staticflickr.com/65535/53022263535_d2664e5da5_o.pn g" target="_blank">https://live.staticflickr.com/65535/53022263535_d2664e5da5_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMoXFv ]Cafe details[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr

Step 3: From cafe page, pick a route:
[url= https://live.staticflickr.com/65535/53022042894_3988359e67_o.pn g" target="_blank">https://live.staticflickr.com/65535/53022042894_3988359e67_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMnQ6m ]Routes[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr

Step 4: See route details and see alternate cafe options
[url= https://live.staticflickr.com/65535/53022263540_4a5741b347_o.pn g" target="_blank">https://live.staticflickr.com/65535/53022263540_4a5741b347_o.pn g"/> [/img][/url][url= https://flic.kr/p/2oMoXFA ]Route details[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr


 
Posted : 04/07/2023 12:49 pm
Posts: 1167
Full Member
 

I prefer not to give out a GPS file.

That way people can't complain if I miss a turning, or change the route to get some more miles in 🙂


 
Posted : 04/07/2023 12:54 pm
Posts: 13594
Free Member
Topic starter
 

That way people can’t complain if I miss a turning, or change the route to get some more miles in 🙂

All the routes get posted on FB and WA on Thursday or Friday before the WE, so you know which group is going where and who is leading, plus what the route is.

Handy when you get dropped by the fast group (as that group does not have a 'no drop' rule). Not that they'd drop you Andy....


 
Posted : 04/07/2023 12:59 pm
sirromj reacted
Posts: 13594
Free Member
Topic starter
 

Plus the social aspect...

Took a while to guess LA's email to get his Gravatar to appear properly...

[url= https://live.staticflickr.com/65535/53022277640_08967482ea_o.jp g" target="_blank">https://live.staticflickr.com/65535/53022277640_08967482ea_o.jp g"/> [/img][/url][url= https://flic.kr/p/2oMp2SG ]Comments[/url] by [url= https://www.flickr.com/photos/brf/ ]Ben Freeman[/url], on Flickr


 
Posted : 04/07/2023 1:04 pm
Posts: 43345
Full Member
 

Just a thought that came to me while riding... many units have a maximum number of points that can be used in a Route. Trackpoint numbers are much less restricted.


 
Posted : 04/07/2023 2:09 pm
Posts: 13594
Free Member
Topic starter
 

Just found another reason the routes I downloaded from Strava were so large, they contain HR data...

<trkpt lat="52.1983720" lon="0.1432350">
<ele>17.1</ele>
<time>2023-05-14T08:55:16Z</time>
<extensions>
<gpxtpx:TrackPointExtension>
<gpxtpx:hr>113</gpxtpx:hr>
</gpxtpx:TrackPointExtension>
</extensions>
</trkpt>

Stripping that off will save space...


 
Posted : 04/07/2023 2:50 pm
Posts: 13594
Free Member
Topic starter
 

5 MB -> 2.5 MB just from stripping out the HR data, probably get to sub 1 MB once I've sub-sampled it.


 
Posted : 04/07/2023 4:41 pm
Posts: 23277
Free Member
 

You need a Douglas pecker algorithm. It’s a recursive algorithm for simplifying linear features within a set tolerance. Ie your simplified line has to fit within a 10m tolerance of your original line.

You should be able to fit it in 20 lines of python..


 
Posted : 04/07/2023 6:49 pm
Posts: 8771
Full Member
 

Or use gpsbabel linked above
> https://www.gpsbabel.org/htmldoc-development/filter_simplify.html <


 
Posted : 04/07/2023 7:12 pm
Posts: 9763
Full Member
 

Just loving this thread

I was on board any way but then I saw you use Jordan's mill cafe which one I use

I was thinking you could add a feature that emails other cyclists warning people like me that the cafe might be busy that day. Sadly you don't need to. I'd never ride to Jordan's mill with a tail wind so we'll never meet


 
Posted : 04/07/2023 8:26 pm
Posts: 13594
Free Member
Topic starter
 

Website is live now: https://www.elsr.co.uk/

Still needs a bit of tidying up for mobile users, but basically there.


 
Posted : 05/08/2023 10:01 am

6 DAYS LEFT
We are currently at 95% of our target!