transit_model Build Status

transitmodel is a rust crate to manage transit data. Its model corresponds to the one used in navitia. This repository also provides : - (incomplete) GTFS to NTFS and (soon) NTFS to GTFS conversion. - (incomplete) Generation of transfers. . - Merge [NTFS] (https://github.com/CanalTP/navitia/blob/dev/documentation/ntfs/ntfsfr.md).

Compile

bash cargo build --release

Compile for KV1

The KV1 format needs a additional dependency called Proj.4 which allows the transformation of localization coordinates. crates.io provides a proj crate which is a binding to the C library (version 6.1.0). This means you need Proj.4 version 6.1.0 installed on your system. See Proj.4 installation instructions or take a look at our Dockerfile. ```

Proj.4 is configured as a feature of the transit_model crate. Once Proj.4 is installed, you need a few more dependencies for building transit_model. apt install -y clang libssl-dev cargo build --features=proj

Now, you should be able to use the converter kv12ntfs. Enjoy!

Using Proj.4

If you want to use Proj.4 in your code, you can if you activate the proj feature (cargo build --features=proj). Then don't forget to protect your code with #[cfg(feature="proj")].

Converting from GTFS to NTFS

NTFS needs a Dataset and a Contributor. Default ones are provided by the command but you can pass a json file that contains some information for creating a Dataset and a Contributor as explained in the documentation.

json { "contributor": { "contributor_id" : "your_contributor_id", "contributor_name" : "your_contributor_name", "contributor_license" : "your_contributor_license", "contributor_website" : "your_contributor_website" }, "dataset": { "dataset_id" : "your_dataset_id", "dataset_desc" : "optional_dataset_desc", "dataset_system" : "optional_dataset_system" } }

Usage

bash target/release/gtfs2ntfs -h

Example

bash target/release/gtfs2ntfs -i path/to/input/directory -c path/to/config.json -p PREFIX -o path/to/output/directory

With docker

bash docker run --rm -v path/to/input:/app/input -v path/to/output:/app/output navitia/transit_model gtfs2ntfs -i /app/input -o /app/output -c /app/input/config.json -p PREFIX

Tests

bash cargo test

License

Licensed under GNU General Public License v3.0