#collection #index

transit_model_collection

Manage collection of objects

2 releases

✓ Uses Rust 2018 edition

0.2.0 Oct 30, 2019
0.1.1 Oct 30, 2019
0.1.0 Sep 12, 2019

#139 in Data structures

Download history 33/week @ 2019-09-10 35/week @ 2019-09-17 24/week @ 2019-09-24 19/week @ 2019-10-01 51/week @ 2019-10-08 64/week @ 2019-10-15 13/week @ 2019-10-22

81 downloads per month
Used in 2 crates

AGPL-3.0

35KB
377 lines

transit_model Build Status

transit_model is a Rust crate managing transit data by implementing the NTFS model v0.9.1 (used in navitia). See the section NTFS: Level of Support for more details about the level of support of the NTFS standard.

This repository also provides :

Compile

cargo build --release

Compile for KV1

The KV1 format needs a additional dependency called PROJ 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 version 6.1.0 installed on your system. See PROJ installation instructions.

PROJ is configured as a feature of the transit_model crate. Once PROJ is installed on your machine, 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

If you want to use PROJ 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")].

Benchmarking

A few benchmarks are available if you want to compare performance of a new feature or of an optimization. Benchmarking functionality is only available in Rust Nightly so to run them, you can do the following.

cargo +nightly bench --all-features

Of course, if you need to run one specific bench, you can refer to a specific bench name in benches/.

rustup run nightly cargo bench read_kv1 --features 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.

{
    "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

target/release/gtfs2ntfs -h

Example

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

Tests

cargo test

NTFS: Level of Support

transit_model is partially supporting v0.9.1 of NTFS (see CHANGELOG in French). From the standard, some of the functionalities are not fully supported:

  • Management of pathways introduced in version v0.8 is not supported
  • No support for all periodic description (files grid_calendars.txt, grid_exception_dates.txt, grid_periods.txt and grid_rel_calendar_line.txt)
  • No support for Line Groups (files line_groups.txt and line_group_links.txt)

License

Licensed under GNU General Public License v3.0

Dependencies

~1.5MB
~37K SLoC