UKC

Route cards, way to get GPX file.

New Topic
This topic has been archived, and won't accept reply postings.
 guffers_hump 03 Feb 2022

Is there a way to download the GPX file for the route cards that are on here? Would make things a lot easier to transfer to my OS maps app.

Cheers

Post edited at 16:02
In reply to guffers_hump:

There was a discussion in 2020. I hacked a script to generate GPX, but I'm not sure if the site changed. GPX files are very easy to generate.

I can't even find route cards on the site now...

https://www.ukclimbing.com/forums/hill_talk/downloading_gps_from_activity_d...

In reply to captain paranoia:

> I can't even find route cards on the site now...

...because they're on UKH, not UKC...

Still can't see a means to download GPX. Maybe they don't want to give their GPX files away...? I'm sure it's not because generating GPX files is hard to do; my simple AWK script is just 37 lines, and wordy at that...

There are some odd behaviours with the route mapping presentation; Help/Layers causes a pop-up to appear that can't be removed. the 'Ordenance Survery' maps aren't available (ah: they are on my home machine: work machine obviously doesn't appear to be in the UK)...

OP guffers_hump 07 Feb 2022
In reply to captain paranoia:

Does this script work?

I can just make the route side by side the one already on here. But just thought as they provide route cards wondered why they wouldn't provide GPX's.

In reply to guffers_hump:

> Does this script work?

Yes. You do need Awk, though, so linux or cygwin installations. It needs manual extraction of the CSV values from the page source, but it would be easy enough to add a trigger on the 'kml' text in the saved page source.

As I said, I don't really understand why GPX isn't provided. I can only think it is a deliberate choice not to.

Post edited at 10:44
In reply to guffers_hump:

We used to have this function but it broke. Have now fixed it and added a button to the sidebar.

In reply to captain paranoia:

Have fixed the popup and spelling mistake(!), but can't replicate the layer not working unfortunately.

In reply to Andy Ovens - UKC and UKH:

The layer issue was probably my corporate VPN; OS mapping worked fine on my home machine.

The question remains (and why I flagged this thread): why are GPX downloads not available? GPX is utterly trivial to generate; if you can generate CSV, you can generate GPX.

1
OP guffers_hump 07 Feb 2022
In reply to Andy Ovens - UKC and UKH:

Brill thats great.

It may have been that this one particular route didn't have GPX data while the others did.

https://www.ukhillwalking.com/logbook/r/?i=922

Many thanks anyway!

In reply to captain paranoia:

If you’re still not seeing the download button, try emptying your cache and visiting:

https://www.ukclimbing.com/clear_cache.php
 

In reply to Andy Ovens - UKC and UKH:

Has the GPX download button always been there, and I've been too dozy to see it...? Admittedly, it looks like I may not be the only dozy one...

Or has it been added since that 2020 thread?

[edit: ah, I see your earlier comment about it breaking and now being fixed: many thanks]

Post edited at 17:07
In reply to Andy Ovens - UKC and UKH:

Just tried it. Orux failed to load it. Looks like there's a bit of weirdness that isn't GPX:

<? popin(400,166098,TRUE,"center")?>

Removed that and Orux was happy.

You could also usefully use the <ele> tag for each track point, since you have that information (at least in the route I looked at).

In reply to captain paranoia:

e.g.

<trkpt lat="57.1465" lon="-3.6788">
<ele>462.9</ele>
</trkpt>

In reply to captain paranoia:

> Looks like there's a bit of weirdness that isn't GPX:

Firefox's XML viewer doesn't like it, either.

XML Parsing Error: not well-formed
Location: file:///C:/Users/User/AppData/Local/Temp/Ben%20Lui,%20Ben%20Oss%20and%20Bei...
Line Number 11, Column 8:
<?popin(550,254106,TRUE,"center")?>

In reply to captain paranoia:

Have fixed the malformed XML for (hopefully) all route cards. Also added the elevation data as requested

OP guffers_hump 10 Feb 2022
In reply to Andy Ovens - UKC and UKH:

When I try to upload the route to OS maps I get GPX contains 0 routes?

In reply to guffers_hump:

There isn't a route. There is a track, though. OruxMaps is quite happy to load the GPX files.

The route/track distinction is a bit arbitrary. A route is intended as a plan, and a track intended as the record of following a route, but it should be possible to use a track as a route, unless your s/w is very picky.

In reply to captain paranoia:

Huh, thats interesting. I could easily convert it to a route, is probably more fitting.
can't see any benefit of having it as a track rather than route

In reply to guffers_hump:

A bodge would be to open the GPX with a text editor, and do a global search and replace of 'trk' with 'rte'.

Maybe Andy could consider changing to use GPX routes, rather than GPX tracks.

Or maybe the OS should consider improving their rubbish app...

In reply to Andy Ovens - UKC and UKH:

> Huh, thats interesting. I could easily convert it to a route, is probably more fitting.

It might be more fitting. I'd make sure that is the problem with the OS app first; maybe the bodge I suggested above, or look to see if there is a track import option. I don't have the OS app installed any more (Orux is so much better, if you have mapping access), so I can't test it.

I don't know where your GPX files come from, or how you import them. Manually planned routes would usually be a rte (although I think Orux uses trk), and actual recorded GPX files are likely to be trk.

Stupidly, the OS app exported planned routes as both rte and trk, which Orux then reported as twice the length... I wrote a script to split them out...

Post edited at 15:49
In reply to captain paranoia:

Have changed to rte for now, as seems more fitting.

Can change back if needed, but can't foresee any issues

In reply to Andy Ovens - UKC and UKH:

> Have changed to rte for now, as seems more fitting.

If the route card is from an uploaded to GPX, there may be a lot more points than you might expect with a rte. Depending on the logging rate... My colleague who developed the 'WheresThePath' website added a point decimator facility. It was fairly smart, IIRC, doing some curve fitting, rather than simple decimation.

OP guffers_hump 11 Feb 2022
In reply to Andy Ovens - UKC and UKH:

So, the app is probably pants. I can convert the route on all trails then it uploads to OS maps.

Doesn't require much effort to do that.

I did change all the trk to rte on notepad and I couldn't get it to work like that.

Post edited at 09:55
OP guffers_hump 11 Feb 2022
In reply to captain paranoia:

When looking on a GPS with either a route or a track would I the user see any difference?

In reply to guffers_hump:

Depends on the behaviour of your software. Obviously, you're seeing a difference with OS map app. Some apps might interpret a rte as a set of points to follow, and a trk as just a line to draw on a map.

As I mentioned above, a trk from an actual GPS log may have a lot more points than an entered rte (e.g. 1 per second at the normal GPS fix rate). The logging rate can usually be controlled by the logging app.

In reply to guffers_hump:

> So, the app is probably pants

The OS app is pretty poor, generally. This appears to be another example.

I tried a simple search & replace of trk/rte, and Orux was perfectly happy. Behaves identically for rte and trk.

Andy has changed to generate rte files. Does the OS app accept these?

Andy, I do note that you don't declare the use of the GPX schema in your files; that would be 'polite' for an XML-based file. I doubt it is the problem, but...

e.g. this is my header:

<?xml version="1.0"?>
<gpx version="1.1"
creator="ukh_csv2gpx.awk"
xmlns="http://www.topografix.com/GPX/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">

Can't remember where I got that example from... My scripts have been around for some time, from when I was working on a GPS/IMU fused navigation project...

edit: well, that knackered the link parser...

Post edited at 11:43
 Martin W 11 Feb 2022
In reply to captain paranoia:

> A bodge would be to open the GPX with a text editor, and do a global search and replace of 'trk' with 'rte'.

> Maybe Andy could consider changing to use GPX routes, rather than GPX tracks.

> Or maybe the OS should consider improving their rubbish app...

Using the 'new' version of the OS Maps web app, I can upload GPX files downloaded from Garmin Connect as routes in OS Maps just fine, and they use trk not rte.

I can't get a GPX downloaded from UKH to upload into OS Maps at all, whether the tags are set to trk or rte.  The error I get is "Sorry...  We're are unable to upload your Route right now. Please try again later."  Which sounds as if it's meant to mean "somethings not working at the moment", but since I can upload a GPX from Garmin Connect with no problem, I suspect something else is wrong and the error message is  (typically*) unhelpful/misleading.

* Not just an OS thing: far too many error messages these days are simply nonsense.  I think Microsoft's "this program has performed a illegal operation" message set the bar for thunderingly unhelpful error messages way back in the 1990s. Would never have got through testing back in my day grumble mumble stops to shout at clouds...

In reply to Martin W:

> I can't get a GPX downloaded from UKH to upload into OS Maps at all, whether the tags are set to trk or rte.

I guess it will be a matter of removing all but the track/route data, and then adding the extras back until it stops working.

Of course, as I said, Orux accepts them without problem.

I can't see anything untoward in the file. There are some oddly placed spaces at the start of lines, and tag breaks in odd places (e.g. </wpt><wpt> pairs, where I'd close the </wpt> and start the next one on a new line), but a good xml parser ought to ignore such things. But a badly-written parser might be confused. Judging by the general low quality of the OS app, it wouldn't surprise me if their xml parser is poor, too.

Post edited at 15:04
OP guffers_hump 12 Feb 2022
In reply to Martin W:

So I swapped all the trk to rte and all the ' to " and still didn't work. But I'm not that smart.

What did work though was converting the gpx on alltrails free converter then it uploaded no problem. I can't see any difference between the alltrails converted gpx and my gpx that I've fiddled with apart from spaces.

I'm sure it's something simple I'm missing.

 Martin W 12 Feb 2022
In reply to guffers_hump:

> So I swapped all the trk to rte and all the ' to " and still didn't work. But I'm not that smart.

> What did work though was converting the gpx on alltrails free converter then it uploaded no problem

Hmm.  I tried loading a UKH GPX file in to Alltrails and it seemed happy with it.  When I downloaded it again, OS Maps wouldn't take it.  Looking at the GPS downloaded from Alltrails, it seemed to contain some unprintable characters, which I suspect might have upset OS Maps.

How did you do the conversion using Alltrails?

Further experimentation showed that MapMyRun will not upload GPX files from UKH or Walkhighlands.  To be fair, it does say: "GPX files must include track and time data to upload properly. Most GPX files created from a workout should be compatible. We cannot process GPX routes based on waypoints."

Edit: Garmin Connect won't accept the UKH or Walkhighlands GPX files either.  Walkhighlands uses rte whereas UKH uses trk.  OSMaps will happily import Walkhighlands GPX files.

Post edited at 12:53
 Martin W 12 Feb 2022
In reply to guffers_hump:

> > What did work though was converting the gpx on alltrails free converter then it uploaded no problem

OK, I found the route converter on Alltrails, but still no joy.  I tried converting the UKH GPX file to both GPX track and GPX route, but neither would load in to OS Maps.  Am I missing something?

FWIW, I'm using the UKH Scald Law route for this testing.

In reply to Martin W:

Maybe try GPSBabel?

 Martin W 13 Feb 2022
In reply to captain paranoia:

> Maybe try GPSBabel?

OK, downloaded that...wouldn't know where to start with it, I'm afraid.

 Martin W 13 Feb 2022
In reply to guffers_hump:

> So I swapped all the trk to rte and all the ' to " and still didn't work.

So I've just tried fiddling about with the UKH GPX file to try to get OS Maps to accept it.  I finally managed to get it to load by:

1) Replacing the 'header' information in the UKH GPX file with the 'header' information from a Walkhighlands GPX file - that's everything from the <?xml version="1.0"?> tag as far as the </metadata> tag.  So there would appear to be something in the UKH 'header' information that it doesn't like.

2) Removing all the "<wpt>...</wpt>" tags between there and the first <trk> tag.  So it doesn't seem to like those tags at all.

OS Maps doesn't seem to mind the use of single quotes instead of double quotes, and it doesn't mind the use of <trk> tags instead of <rte> tags.

How one might go about automating such changes to the UKH GPX files in order to be able to load them in to OS Maps I couldn't say.

In reply to Martin W:

Yea, did my own testing and found OSMaps doesn't like waypoints (weirdly it doesn't mind a single one...)

Have added the xml head info too, thanks for the heads up captain paranoia.

There are now 2 download buttons on the route card page, with/without waypoints.

In reply to Andy Ovens - UKC and UKH:

> Yea, did my own testing and found OSMaps doesn't like waypoints (weirdly it doesn't mind a single one...)

Weirdly, the GPX files it exports do contain waypoints. And rte points and trk points...

Their wpt are just lat/long coordinates. They put the description in the rte points. I'm not sure this is correct...

In reply to Andy Ovens - UKC and UKH:

> thanks for the heads up captain paranoia.

ps. glad to help in some small way.

In reply to captain paranoia:

I had a look at the web inspector when I upload a GPX with multiple waypoints. Seems they do some conversion, but are parsing it in such a way it creates a NaN (Not a Number). basically, looks like a bug!

May be worth emailing them but I suspect it will lead to a dead end, going by other people asking them the same on other forums


In reply to Andy Ovens - UKC and UKH:

Frankly, I don't have a great deal of faith in the abilities of those working on the OS mapping tools, both online and apps. I've provided (what I thought was reasonable) feedback on both, and been ignored. The recent mucking about with user accounts when they launched a new app was an example. You get the impression that they're not really taking it seriously, and that they have a bit of an arrogant 'government agency' attitude: "we're going to do this, and you users can just lump it".

When you consider how good OruxMaps is, written by one person... But then that seems to be a bit of a thing; sometimes you just get a truly brilliant dev working on something. MusicBee comes to mind. Or my colleague's WheresThePath, which had features way in advance of the OS mapping (given that he had fairly considerable interaction with them over their OpenData policy, he suspected that they copied quite a few features from him...). Or even UKC...

Whereas I just hack together a few AWK scripts to manipulate simple data into forms that tools seem happy to accept. Yes, even the OS app, IIRC...

ps. just realised that error report is in JSON. Coincidentally, I've been looking at understanding JSON schemas this week, for the first time...

Post edited at 17:10
In reply to captain paranoia:

I think how they've managed to worsen their app overtime is testament to that, shame really.

Let me know if you have anymore ideas regarding route cards etc.

In reply to Andy Ovens - UKC and UKH:

Does that error report identify which particular 'point' is in error? I might be tempted to guess that it's the first waypoint, and the NaN is its interpretation of the <description> field. i.e. they're not parsing the wpt properly, because they don't think wpts have anything other than <lat> and <lon>. Or at least, that's how they use them (or did).

In reply to captain paranoia:

It was the first waypoint yea. But as I mentioned, if I removed all bar that one... it worked!

Didn't try removing the <desc>, did try tweaking the contents of <name> though

I wondered if they were expecting an <ele>, but think I tried that and still no luck.

To be honest, once I realised it worked without waypoints, adding the second button to the Route Card page seemed the best approach

In reply to Andy Ovens - UKC and UKH:

> To be honest, once I realised it worked without waypoints, adding the second button to the Route Card page seemed the best approach

Yeah. There's only so much you can do to cater for badly-written third-party apps. Your GPX has always been accepted and works as expected by Orux, so it has never been 'wrong'.

 Martin W 16 Feb 2022
In reply to Andy Ovens - UKC and UKH:

> Yea, did my own testing and found OSMaps doesn't like waypoints (weirdly it doesn't mind a single one...)

> Have added the xml head info too, thanks for the heads up captain paranoia.

> There are now 2 download buttons on the route card page, with/without waypoints.

Andy, thanks for making that change for us OS Maps users.

ISTR that there used to be a quick way to switch back and forth between UKC and UKH, like a button in the page header.  Is my memory deceiving me (yet again) or does it no longer exist?

(And yes, I know it would be easy enough to add a book mark for UKH as well as UKC, but I prefer to avoid bookmarks proliferating if it can be avoided.)

Edit: Just found it at the bottom of the page!

Post edited at 21:25
OP guffers_hump 24 Feb 2022
In reply to Martin W:

Yes I found Walkhighlands GPX's to upload to OS no problem.

OP guffers_hump 24 Feb 2022
In reply to guffers_hump:

Really appreciate what you guys here have done!


New Topic
This topic has been archived, and won't accept reply postings.
Loading Notifications...