Canalplan Forums

Discussions => General Chat => Topic started by: Aegidian on Jun 18, 2026, 03:04 PM

Title: Adventures in coding!
Post by: Aegidian on Jun 18, 2026, 03:04 PM
So...

I've been using canalplan's api for several years as the back end to my boat moving business's route planner. But it's always been a bit tricky, what with the lack of any official support (though the Attys have been brilliant when there have been problems) and with things occasionally going a bit wrong.

And it always felt like I was hammering their website a bit.

So, with some home time on my hands I bit the bullet and downloaded the geojson files, and used them as the basis for my own back end. And it was a TASK.

I had to translate the geojson into something smaller and more useful to me, since they are a bit too memory heavy for my ISP's php install (I ended up using Python as the basis for the backend instead, after struggling with this for a good while.)

Then the waterways had to be split up, so that they formed a graph with simple nodes and edges.

Then I had to implement A-Star route searches - which turned out to be easier in Python than I imagined, as it had 'heap' storage built in. Then optimising a ton of place searching algorithms for speed (yuk.)

It's pretty much done, after about six weeks of on-again-off-again tinkering. No more hammering the canalplan website for routefinding!

Tadaa: https://yourhelmsman.co.uk/trip.shtml (https://yourhelmsman.co.uk/trip.shtml)
Title: Re: Adventures in coding!
Post by: Stephen Atty on Jun 18, 2026, 08:59 PM
Impressive - it is interesting that it takes the long way round brum - so increases the miles but takes the lock count down a long way

Trip info: Lockmiles 156 (116 miles and 40 locks.)


Total distance is 86 miles, 6¾ furlongs and 107 locks