The Itinero-Transit-Server is a wrapper around the core library itinero-transit. The core library offers routing over a public transport network, this small wrapper makes that available via HTTPS.
A demo is deployed here. The full documentation (as swagger file) can be found there as well.
If the server is offline, a backup swagger file is available in the repo too. To load this interactively:
This project assumes that you have a working dotnet environment on your Linux device. If you don't have dotnet, follow this guide
# Clone the project
git clone git@github.com:anyways-open/itinero-transit-server.git
cd itinero-transit-server
# Start the server
cd src/Itinero.Transit.Api/
dotnet run
The program will now load a bunch of data for the Belgian Public Transport agencies.
Have a look at the status page how your server is doing. The loaded time windows indicate what dataset has been loaded already. In the loaded parts, planning is possible. There is no need to wait until every PT-operator has been completely loaded.
With the server running, visit the API-documentation page to see what is possible.
First, a small overview of the directories in the git repo:
src
contains all the source codetest
contains all the test codedocs
contains an example swagger filedeployment
contains a script to deploy this as a docker container on a serverThe project itself is a pretty straightforward C#/ASP.net project. Requests come in via HTTP and are delegated to a controller-class in Controllers/
. They return an appropriate Model
as JSON.
The controllers themselfs do not contain the algoirthms themselves. These are contained in Logic/
. One important class in Logic/
is State.cs
. The State
contains the global variables, namely a pointer to the transitdbs which the logic and controllers use.
As State is a central piece in the app, go read it now. Every field is documented.
The next important class is Startup
where the State is constructed.
Overview of other Logic
: classes:
ChangeableMaxNumberOfTransferFilter
filters journeys based on a maximum number of total transfers - but this setting can be changed halfway calculations if needed. This is one of the few classes which has a changeable state (most classes only have readonly fields)