Author Topic: Auto generated routesheets  (Read 5446 times)

simonp

  • Omnomnomnipotent.
Auto generated routesheets
« on: September 18, 2010, 02:58:43 pm »
I've written a Python script which takes a gpx file and converts it to a routesheet.

So the riders on my events next weekend will get the honour of being the first to try it out.

(Well not entirely: I rode the 200k last weekend using it. And I'm riding the 100 right now and the 200k again with a helper tomorrow).

The distance calculation seems to be perfect (it uses the track from the gpx). Still can have human error: there are still a couple of minor errors on the 100k routesheet. Things like R SP SWAFFHAM BULBECK which should say R SP SWAFFHAMS. That one is unlikely to throw people as it also says by Bell PH and grass triangle.

Big gain is if you alter the route you don't need to fix the distances. And the layout work is automatic. You just need to get all the turns right. :)

Panoramix

  • 50 61 6E 6F 72 61 6D 69 78
  • Suus cuique crepitus bene olet
    • Some routes
Re: Auto generated routesheets
« Reply #1 on: September 18, 2010, 03:15:54 pm »

Interesting!

How does it work then, do you do a gpx with one instruction per sheet and enter the route instructions in the script. Or does the script look in google maps to have a go at doing some instructions.

I've been trying to do a gpx maker in python (one instruction per turn), retrieving the instructions from cloudmade maps (there is an API) and then getting the script do the waypoints coordinates and name. The problem I am having is that the instructions are not always good enough.

Chief cat entertainer.

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #2 on: September 18, 2010, 05:50:13 pm »
Yes, that's it.  I drew the track manually in tracklogs and added waypoints for each turn.  You can see the gpx file used at the event pages for the two events (26th Sept, Cambridge 100 and Cambridge 200).  The routesheets are there also.

You could generate the track automatically as well, but I draw a track when I make a gpx anyway, as I need something to check distances against.

So the script just works through the waypoints in turn, and finds the closest place on the track (interpolating between track points as needed) to generate a distance for each waypoint.  The distance calculation is based on WGS84, which is way more accurate than is really needed: there is more error from hidden terrain distance (which I don't currently allow for, though given a track with altitude, I could do that) and from sampling issues: the fewer track points, the shorter the track is.  Going from 600-odd points to 450 or so reduces the overall distance by 0.4km on a 100k route.

The automatic nature means the layout is now something that I don't have to bother with, too.  It generates an html table for each section, and that has page-break-before:always set, so each section is on its own page (or half-page: I use 2-up printing to print the routesheets).  I originally tried outputting csv and importing that into a spreadsheet but it's too cumbersome and handling multi-line complex information e.g. "Info control by grass triangle; answer question on Brevet card" has to be over multiple lines; doing this in a spreadsheet is painful, whereas in an html table cell the row gets taller to accommodate it.

I've also just added a mechanism to support alternate route sections (e.g. to avoid a nasty or difficult section).  This currently is a little bit crude; the alternate is in a separate gpx file (probably will always be the case) and is tacked to the route by a special waypoint which tells the distance at which it should start (so that the distances in the alternate match up correctly).  This is of course redundant since the waypoint could be found on the original track as with the others, but currently the way the code is structured, only one track can be managed at a time so that needs some rework.

The idea of routesheet to gpx is harder, I think.  It requires a bit of AI due to the variable nature of instructions.  I think one could come up with something that did a bit of look-ahead to work out if following a particular course matched later turns or not (I end up having to do this sometimes myself when converting routesheets to gpx).  But it seems tricky, and routesheets often have errors which the program going to struggle to resolve.

Panoramix

  • 50 61 6E 6F 72 61 6D 69 78
  • Suus cuique crepitus bene olet
    • Some routes
Re: Auto generated routesheets
« Reply #3 on: September 18, 2010, 06:50:03 pm »

I think it is a brilliant idea, with a bit (OK an awful lot) of work you could do an automatic DIY/route planner (mesh style) if enough people were to start planning their routes like this and their was a central repository of GPX files.


I wasn't trying to do routesheet to gpx but google map or cloudemade map to GPX so that I could do a route on say google map and generate automatically a turn by turn GPX.
Chief cat entertainer.

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #4 on: September 18, 2010, 07:04:51 pm »

I think it is a brilliant idea, with a bit (OK an awful lot) of work you could do an automatic DIY/route planner (mesh style) if enough people were to start planning their routes like this and their was a central repository of GPX files.


I wasn't trying to do routesheet to gpx but google map or cloudemade map to GPX so that I could do a route on say google map and generate automatically a turn by turn GPX.


Sorry my misunderstanding; the term "instruction" drew all my attention.

The idea of an automatic mesh route planner is interesting; but the work to generate high-quality routes between control towns could be huge.  Currently mesh type stuff is free route which is much lower admin but does mean each rider has to do their own route planning.


Panoramix

  • 50 61 6E 6F 72 61 6D 69 78
  • Suus cuique crepitus bene olet
    • Some routes
Re: Auto generated routesheets
« Reply #5 on: September 18, 2010, 10:00:31 pm »

The idea of an automatic mesh route planner is interesting; but the work to generate high-quality routes between control towns could be huge.  Currently mesh type stuff is free route which is much lower admin but does mean each rider has to do their own route planning.


Yes but say one could make a website where it would be possible to make routesheet/GPX by clicking on junctions and entering the instruction, hopefully the database of routes would grow as more and more people use it as their preferred tool. The aim would be to redirect all the energy riders spend preparing their GPX into something more productive in the long run.
Chief cat entertainer.

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #6 on: September 18, 2010, 10:06:28 pm »

The idea of an automatic mesh route planner is interesting; but the work to generate high-quality routes between control towns could be huge.  Currently mesh type stuff is free route which is much lower admin but does mean each rider has to do their own route planning.


Yes but say one could make a website where it would be possible to make routesheet/GPX by clicking on junctions and entering the instruction, hopefully the database of routes would grow as more and more people use it as their preferred tool. The aim would be to redirect all the energy riders spend preparing their GPX into something more productive in the long run.

I thought there was a DIY route website already - something Danial worked on?

Of course having the ability to generate a route sheet would open this up to more users.

mattc

  • n.b. have grown beard since photo taken
    • Didcot Audaxes
Re: Auto generated routesheets
« Reply #7 on: September 19, 2010, 03:35:33 pm »

The idea of an automatic mesh route planner is interesting; but the work to generate high-quality routes between control towns could be huge.  Currently mesh type stuff is free route which is much lower admin but does mean each rider has to do their own route planning.


Yes but say one could make a website where it would be possible to make routesheet/GPX by clicking on junctions and entering the instruction, hopefully the database of routes would grow as more and more people use it as their preferred tool. The aim would be to redirect all the energy riders spend preparing their GPX into something more productive in the long run.
If I've understood your idea correctly:
it will fall down at joining the pre-built segments together. As everyone knows, the hardest navigation is usually getting OUT of a town!

What did you find was the problem with Google Maps instructions? They are a bit vague:
"Turn R towards Bogton" when there is no signpost, and
they are longer than required:
"turn r on Bog St" where the road simply follows R anyway etc.

... but I suspect that with distances they would form a complete instruction set.
I have never checked a whole one to be sure.
Has never ridden RAAM
---------
No.11  Because of the great host of those who dislike the least appearance of "swank " when they travel the roads and lanes. - From Kuklos' 39 Articles

Euan Uzami

Re: Auto generated routesheets
« Reply #8 on: September 19, 2010, 04:35:42 pm »
Does it generate the actual instructions for you, given the route? Or do you have to tell it at what points the rider has to do something OTHER than go straight on? (and what that other is?)


Re: Auto generated routesheets
« Reply #9 on: September 19, 2010, 04:38:59 pm »
Does it generate the actual instructions for you, given the route? Or do you have to tell it at what points the rider has to do something OTHER than go straight on? (and what that other is?)


I think this "I drew the track manually in tracklogs and added waypoints for each turn" gives it away. I presume he wrote the instruction in the waypoint.

Euan Uzami

Re: Auto generated routesheets
« Reply #10 on: September 19, 2010, 04:44:27 pm »
Does it generate the actual instructions for you, given the route? Or do you have to tell it at what points the rider has to do something OTHER than go straight on? (and what that other is?)


I think this "I drew the track manually in tracklogs and added waypoints for each turn" gives it away. I presume he wrote the instruction in the waypoint.

hmm. I guessed so. I have often wondered how difficult it would be to write something that avoided you even having to do that, just give it the route and it decides where and what the instructions are.
There is enough data to make it possible, certainly in teleatlas, whether in opensource or not i don't know  (although either way it would be quite a lot of work).

still impressive though


frankly frankie

  • I kid you not
    • Fuchsiaphile
Re: Auto generated routesheets
« Reply #11 on: September 19, 2010, 05:13:06 pm »
What did you find was the problem with Google Maps instructions? They are a bit vague:
... ... but I suspect that with distances they would form a complete instruction set.

I agree.  And if you select 'Print' when you have Gmap-derived instructions on screen, you get something like:
.
makes a half-decent routesheet I'd suggest - too detailed really - though the vital missing thing is what is on the signage.

If you derive a GPX of that using GmaptoGPX these instructions are embedded in the GPX.
It's not dark yet but it's getting there.

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #12 on: September 19, 2010, 05:32:05 pm »
They are missing essential things:

- signposts, other route clarification stuff (eg by pub)
- warnings about places to take extra care

I think it's easier to do your own turns with all tge necessary info than try to add it to something already generated.

Panoramix

  • 50 61 6E 6F 72 61 6D 69 78
  • Suus cuique crepitus bene olet
    • Some routes
Re: Auto generated routesheets
« Reply #13 on: September 19, 2010, 05:45:55 pm »
They are missing essential things:

- signposts, other route clarification stuff (eg by pub)
- warnings about places to take extra care

I think it's easier to do your own turns with all tge necessary info than try to add it to something already generated.


Yes exactly, I know how to create a waypoint "Left" when necessary but what do I do with "slight left" and "continue".  I have done one manually but the thing was beeping all the time with all these waypoints. And the right immediately left were very confusing (2 waypoints spaced by 10 meters).

The dakota has a longer field so I would like to take advantage of this.

I wasn't intending it as a way to make routesheet for events but a GPX to cycle to the start or to go somewhere in general without spending an hour planning.
I know how to retrieve the info, but it needs reformatting which I hadn't foreseen.
Chief cat entertainer.

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #14 on: September 19, 2010, 08:18:21 pm »
They are missing essential things:

- signposts, other route clarification stuff (eg by pub)
- warnings about places to take extra care

I think it's easier to do your own turns with all tge necessary info than try to add it to something already generated.


Yes exactly, I know how to create a waypoint "Left" when necessary but what do I do with "slight left" and "continue".  I have done one manually but the thing was beeping all the time with all these waypoints. And the right immediately left were very confusing (2 waypoints spaced by 10 meters).

The dakota has a longer field so I would like to take advantage of this.

I wasn't intending it as a way to make routesheet for events but a GPX to cycle to the start or to go somewhere in general without spending an hour planning.
I know how to retrieve the info, but it needs reformatting which I hadn't foreseen.

For sure. My motivation was for audax events. A high quality audax route sheet needs to have these things or you will be murdered at tge finish. ;)

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #15 on: September 19, 2010, 09:14:41 pm »

The idea of an automatic mesh route planner is interesting; but the work to generate high-quality routes between control towns could be huge.  Currently mesh type stuff is free route which is much lower admin but does mean each rider has to do their own route planning.


Yes but say one could make a website where it would be possible to make routesheet/GPX by clicking on junctions and entering the instruction, hopefully the database of routes would grow as more and more people use it as their preferred tool. The aim would be to redirect all the energy riders spend preparing their GPX into something more productive in the long run.
If I've understood your idea correctly:
it will fall down at joining the pre-built segments together. As everyone knows, the hardest navigation is usually getting OUT of a town!

What did you find was the problem with Google Maps instructions? They are a bit vague:
"Turn R towards Bogton" when there is no signpost, and
they are longer than required:
"turn r on Bog St" where the road simply follows R anyway etc.

... but I suspect that with distances they would form a complete instruction set.
I have never checked a whole one to be sure.

So the mesh type things assume point-to-point distances rather than blob-to-blob (i.e. some notion of Cambridge being a point rather than a blob).

So if someone is doing a mesh ride where they arrive at Cambridge from the west and leave to the East then it's likely that they will cross through the centre - so gpx routes which go from point-to-point are probably acceptable.

Where this falls down is say arriving from the East (Newmarket, say) and leaving to the South (to Saffron Walden).  These are contrived examples: I don't know what the Mesh uses.  You can shorten the ride a bit by controlling on the edge of Cambridge:

Using town names:

Google Maps

Using "optimised" control locations which would, I think be deemed acceptable:

Google Maps

This is almost 6km shorter!  Though the towns are closer together than Mesh towns tend to be.

One could add "circular" routes around towns to link up the axial entry/exit routes, at extra effort.  This would avoid forcing people to enter busy town centres.

However, a bigger concern for me would be the legal issues.  Once you start providing prescribed routes, you better be damn sure they have been checked properly.

Oaky

  • ACME Fire Safety Officer
  • Audax Club Mid-Essex
    • MEMWNS Map
Re: Auto generated routesheets
« Reply #16 on: September 19, 2010, 09:25:51 pm »
Re: Google directions...

When trying to construct bike routes to navigate places where I've never been, I've found the Googl directions next to useless.  There are too many instructions, most of which, although saying "Turn Left" or "Turn Right" are actually staying on the same road.  They also at real turns have a habit of telling you to, e.g., turn L onto Turnspittle Road, but typically there's no reference to where that goes (i.e. no signpost info), and worse, there's often no indication when you get to that road that it is Turnspittle road.

I've laboured through them deleting irrelevant ones and correcting others by reference to the Google satellite imagery (or more recently streetview) but it's painful.

BikeRouteToaster does a better job, IMHO, of giving me a cue sheet which I can clean up to actually navigate somewhere.

The above isn't strictly relevant though - we're talking above more about routes that have been ridden previously by the person generating the sheet.
You are in a maze of twisty flat droves, all alike.

85.4 miles from Marsh Gibbon

Audax Club Mid-Essex Fire Safety Officer
http://acme.bike

vorsprung

  • Opposites Attract
    • Audaxing
Re: Auto generated routesheets
« Reply #17 on: September 20, 2010, 09:21:23 am »
The value of what simon has done is that a single source gpx could be used to load into a GPS box or to make a route sheet

So the route information only needs to be kept up to date in one place

Audaxing Blog follow @vorsprungbike on

Re: Auto generated routesheets
« Reply #18 on: September 20, 2010, 12:37:41 pm »
I've written a Python script which takes a gpx file and converts it to a routesheet.

So the riders on my events next weekend will get the honour of being the first to try it out.

Quote from: 200 routesheet
STRT        R from control

Err, is that one right?   ;D

simonp

  • Omnomnomnipotent.
Re: Auto generated routesheets
« Reply #19 on: September 20, 2010, 12:44:00 pm »
I've written a Python script which takes a gpx file and converts it to a routesheet.

So the riders on my events next weekend will get the honour of being the first to try it out.

Quote from: 200 routesheet
STRT        R from control

Err, is that one right?   ;D

Well spotted.  :-[

http://twitter.com/simonproven/status/24959646362

Unfortunately I noticed this one on the previous route check also but forgot to update the routesheet with that correction.  I'll be uploading corrected routesheets to the calendar page in the next day or two.  That's the only real error, but it is rather obvious!


Re: Auto generated routesheets
« Reply #20 on: September 20, 2010, 12:49:45 pm »
Heh, it only had me confused because I was trying to identify where the village hall was on streetview, and which side it was on.

Other than that looks good, nice to see you saved a bit of effort putting it together.