Planning Public Transportation with Raku


by Arne Sommer


[159.1] Published 15. December 2021. (Updated 2. January 2022)

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ About | Terms | Files | Commands | FAQ | Changelog | Roadmap | 60 Minutes NEW ]

This article is about my open source module «Transit::Network» and the accompanying program «networkplanner», both written in Raku, that can be used to plan and test public transportation departures. Either on a single route, or on a network with several routes. It supports fixed departure times (minutes past the hour), and can be used to test different intervals. Specify the routes and intervals, and it will give you the required number of vehicles and the departure times.

This documentation has been updated to reflect version v.0.0.4 of the module. The changes from earlier versions are (for the most part) marked.


The planned Oslo tram network in 2024 was the background for the first version of this program. I tried to come up with a better network than the one planned by Ruter (the body overseeing public transportation in the greater Oslo area), and realised that I needed a program to check that all the numbers did add up. So I wrote a program, or rather three. This article is the result of further work, merging all the code into a module and a single wrapper program.

The «networkplanner» program has some quirks as a result of the background as three separate programs. This should not be too noticeable, but the problems will be sorted out in due course.


The following command will download and install the module, after you have installed «Raku» and the module installer «zef»:

$ zef install Transit::Network

The installation will most likely fail on Windows, as the external module «Linenoise» requires a C compiler (and some luck). In that case do a force install:

$ zef --force-install install Transit::Network


This is the main program. It can be used in batch mode (by specifying a network setup file), or interactively as a shell by starting it without any arguments on the command line. It requires the «Linenoise» module to work. The program has command completion (with the «Tab» key). Use the up and down arrow keys to go up and down in the command history, and edit the comamnd before pressing Enter.

A version of the program without the interactive modus support. Use this if you do not have (or want to have) «Linenoise» installed.

A program that reverses a route definition file. (Note that this can be achieved with the «reverse» option to the «route» command in «networkplanner» or «networkplanner-plain» as well.) The result is printed to the screen.

Sample Networks

The module comes with the zip file «» containing all the examples from these articles. Run «networkplanner --help» or «networkplanner-plain --help» to get the location it has been installed to, and copy and upack the file. It is important to keep the directory structure!

It is also possible to download the file; use the link in the «Links» box.

Language Support

The output from the commands given to «networkplanner» and «networkplanner-plain» is in English. You can switch to other languages with the «-lang=FOO» command line option (where «FOO» is one of the supported languages), or the «lang» command.

Supported languages:

  • EN (English) - the default
  • NO (Norwegian)


The program and documentation is © 2021 Arne Sommer, arne.sommer (at)

The programs, libraries and definition files are free software; you can redistribute them and/or modify them under the Artistic License 2.0.

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ About | Terms | Files | Commands | FAQ | Changelog | Roadmap | 60 Minutes NEW ]