Browse by type
Catenary Backend is a distributed system comprised of microservices. The system is designed for fault tolerance, high-avaliability, and native execution speed in x86-64 using the Rust systems programming language.
The code is heavily commented, go to each folder in src for more information.
This project is built off the work of researchers in Germany and many other places, vielen dank!
Motis Project https://github.com/motis-project Felix Gündling, innovation in in-memory data stores for graphs
Early Pruning for Public Transport Routing - Andrii Rohovyi, Abdallah Abuaisha, Toby Walsh https://arxiv.org/abs/2603.12592
Our compression algorithm was validated by the Motis project at https://github.com/motis-project/nigiri, we thank them heavily for their collaberation. - Open Street Router OSR: https://github.com/motis-project/osr Felix Gündling - Hannah Bast, PhD at Freiburg Universitat: Transfer Patterns and Scalable Transfer Patterns - Patrick Brosi: Pfaedle and Line optimised shapes, TRAVIC
Good commit messages are required to contribute to this project.
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install libprotoc-dev protobuf-compiler build-essential gcc pkg-config libssl-dev unzip wget cmake openssl libtbb-dev libpq-dev
sudo apt-get install coinor-cbc coinor-libcbc-dev
sudo apt install postgresql-18 postgresql-18-postgis-3 postgresql-contrib postgresql
See https://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS3UbuntuPGSQLApt for more instructions for PostGIS You may also use an external database if you prefer.
CREATE EXTENSION postgis;
We've switched to diesel for our queries. Read the diesel documentation to learn how to use it. https://diesel.rs/guides/getting-started.html
Lib PQ is also required to install the diesel cli. Only postgres is required. Example
sudo apt-get install libpq-dev
cargo install diesel_cli --no-default-features --features postgres
Is Postgis not installing? This page may be helpful: https://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS3UbuntuPGSQLApt
git submodule update --rebase --remote
The OSM Station Import system associates GTFS railway stops with OpenStreetMap stations. This provides additional metadata like multilingual names, UIC references, and station relationships.
Ensure that Postgres, Elasticsearch, and etcd are all running services.
Then copy example.catenaryconfig.toml to catenaryconfig.toml and insert the URLs and passwords for the services you wish.
Obtain a pre-filtered PBF file containing railway stations (or use one from Geofabrik filtered with osmium):
cargo run --bin osmstationimport -- --file /path/to/railstations.osm.pbf
multiple imports can be done sequentially, and will overwrite old data.
cargo run --bin osmstationimport -- --file railstations-europe-latest.osm.pbf
cargo run --bin osmstationimport -- --file railstations-north-america-latest.osm.pbf
cargo run --bin osmstationimport -- --file railstations-asia-latest.osm.pbf
The importer:
- Computes SHA256 hash to skip duplicate imports
- Extracts rail, tram, and subway stations
- Parses multilingual names (name:en, name:de, etc.)
- Stores in gtfs.osm_stations table with spatial indexing
When Maple processes GTFS feeds, it automatically matches stops to OSM stations for rail/tram/subway routes:
cargo run --bin maple
See the Maple readme for more information.
cargo run --bin alpenrose
cargo run --bin aspen
cargo run --bin aspenleader
cargo run --bin birch
cargo run --bin spruce
The routing engine provides point-to-point transit directions using three main microservices:
Avens takes OpenStreetMap PBF files and compiles them into a serialized routing graph format with an R-Tree spatial index.
To compile a batch of regions using a configuration file (recommended for managing multiple regions):
cargo run --bin avens --release -- batch --config avens_regions.toml
Example avens_regions.toml:
[global]
tmp_dir = "/tmp/avens_raw"
output_dir = "/path/to/graphs"
[[regions]]
name = "germany"
url = "https://download.geofabrik.de/europe/germany-latest.osm.pbf"
[[regions]]
name = "switzerland"
url = "https://download.geofabrik.de/europe/switzerland-latest.osm.pbf"
Procedure for Managing and Updating OSM PBFs:
To manage your region endpoints, simply update the [[regions]] list in your TOML config file. Re-running the batch command will fetch the latest full PBFs from the listed URLs (overwriting old temp files) and regenerate the routing graphs in the output_dir seamlessly.
Alternatively, you can pull directly from a URL and compile a single region:
cargo run --bin avens --release -- pull --url https://download.geofabrik.de/europe/germany-latest.osm.pbf --output-dir /path/to/graphs/germany
To extract a locally downloaded PBF file:
cargo run --bin avens --release -- extract --input /path/to/germany-latest.osm.pbf --output-dir /path/to/graphs/germany
You can view statistics about a compiled graph directory using:
cargo run --bin avens --release -- info --graph-dir /path/to/graphs/germany
Gentian builds a RAPTOR-compatible zero-copy transit routing timetable from data imported into PostgreSQL (e.g., via Maple). It integrates with the Avens graphs to accurately compute transfer footpaths.
cargo run --bin gentian --release -- --output /path/to/timetable.bin --avens-graphs /path/to/graphs
Edelweiss provides the actual routing service via a Tarpc RPC server (listening on 0.0.0.0:9090). It uses the Avens graphs for OSM routing and dynamically loads timetables compiled by Gentian.
GRAPH_DIR=/path/to/graphs cargo run --bin edelweiss --release
browse all types & interfaces →
$ claude mcp add catenary-backend \
-- python -m otcore.mcp_server <graph>