Skip to content

Commit

Permalink
Merge pull request #660 from datanel/doc_gtfs2netexfr
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean SIMARD authored Jun 29, 2020
2 parents b834e43 + 2e0f343 commit d4517ad
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 47 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PROJ_VERSION = 6.3.0

install_proj:
sudo apt update
sudo apt install -y wget build-essential pkg-config sqlite3 libsqlite3-dev clang
wget https://github.com/OSGeo/proj.4/releases/download/$(PROJ_VERSION)/proj-$(PROJ_VERSION).tar.gz && tar -xzvf proj-$(PROJ_VERSION).tar.gz
cd proj-$(PROJ_VERSION) && ./configure --prefix=/usr && make && sudo make install
rm -rf proj-$(PROJ_VERSION) proj-$(PROJ_VERSION).tar.gz
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This repository regroups crates that offer enabler-libraries and binaries to
convert and enrich transit data.

Please check documentation attached to each crate:

* [**gtfs2netexfr**](gtfs2netexfr/README.md) converts [GTFS] data format into
[NeTEx]-France data format.
* [**gtfs2ntfs**](gtfs2ntfs/README.md) converts [GTFS] data format into [NTFS]
Expand All @@ -26,6 +27,14 @@ Please check documentation attached to each crate:
* [**restrict-validity-period**](restrict-validity-period/README.md) restricts
the validity period of a [NTFS] dataset and purges out-of-date data.

## Setup Rust environment

`transit_model` is developed in [Rust].

If you want to contribute or install binaries, you need to install a [Rust] environment: see https://rustup.rs

[Rust]: https://www.rust-lang.org/

## [PROJ] dependency

Based on [PROJ], the [`proj` crate] allows the transformation of
Expand All @@ -36,33 +45,17 @@ So it must be installed on the system to compile and use those crates.

### [PROJ] for binaries

Using the [`proj` crate] requires some system-dependencies installation.

* The version `6.3.0` of [PROJ] is needed (used and tested by maintainers).\
On Debian systems:
```sh
# Needed only for proj install
sudo apt install -yq wget build-essential pkg-config sqlite3 libsqlite3-dev

sudo apt remove libproj-dev # remove system version from packages
wget https://github.com/OSGeo/proj.4/releases/download/6.3.0/proj-6.3.0.tar.gz
tar -xzf proj-6.3.0.tar.gz
cd proj-6.3.0
./configure --prefix=/usr
make
sudo make install

# These dependencies can be removed after PROJ build
# sudo apt purge wget build-essential pkg-config sqlite3 libsqlite3-dev
```
[PROJ installation instructions](https://github.com/OSGeo/PROJ#installation)
may help, too.

* Some packages are also needed.\
On Debian systems:
```sh
apt install -y clang libssl-dev
```
Using the [`proj` crate] requires some system-dependencies installation.\
The version `6.3.0` of [PROJ] is needed (used and tested by maintainers).

To help the installation you can execute the following command (On Debian systems):

```sh
make install_proj
```

[PROJ installation instructions](https://github.com/OSGeo/PROJ#installation)
may help, too.

### Using [PROJ] and transit_model as a developer

Expand Down Expand Up @@ -91,7 +84,6 @@ to test, contribute, report issues.

Licensed under [GNU Affero General Public License v3.0](LICENSE)


[GTFS]: https://gtfs.org/reference/static
[navitia]: https://github.com/CanalTP/navitia
[NeTEx]: http://netex-cen.eu
Expand Down
16 changes: 6 additions & 10 deletions gtfs2netexfr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@ format.

## Installation

To install, you first need to install [PROJ] version 6.3.0. See [PROJ
installation instructions].
To install, you first need to install [PROJ].\
See [PROJ installation instructions].

[PROJ]: https://proj.org/
[PROJ installation instructions]: https://github.com/OSGeo/PROJ#installation

You also need the following dependencies to be installed.

```bash
apt install -y clang libssl-dev
```
[PROJ installation instructions]: ../README.md#proj-dependency

As `gtfs2netexfr` is not pushed to crates.io yet, you can install it by cloning `transit_model`.

Expand All @@ -39,7 +33,9 @@ gtfs2netexfr --input /path/to/gtfs/folder/ --output /path/to/netexfr/ --particip
* `--participant` is an identifier for the instigator of this NeTEx France
export; it is exported in each NeTEx file

Get more information about the available options with `--help`.
Get more information about the available options with `gtfs2netexfr --help`.

Finally, it's possible to [hand-check the output](../CONTRIBUTING.md#hand-check-outputs).

## Specifications

Expand Down
27 changes: 18 additions & 9 deletions gtfs2netexfr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,44 @@ use transit_model::Result;
#[derive(Debug, StructOpt)]
#[structopt(name = "gtfs2netexfr", about = "Convert a GTFS to NeTEx France.")]
struct Opt {
/// input directory.
/// Input directory.
#[structopt(short, long, parse(from_os_str), default_value = ".")]
input: PathBuf,

/// output directory
/// Output directory
#[structopt(short, long, parse(from_os_str))]
output: PathBuf,

/// config file
#[structopt(short, long, parse(from_os_str))]
/// Config file
#[structopt(
short,
long,
parse(from_os_str),
long_help = r"JSON file containing additional configuration.
See https://github.com/CanalTP/transit_model/blob/master/documentation/common_ntfs_rules.md#configuration-of-each-converter
for more information.
"
)]
config: Option<PathBuf>,

/// OnDemandTransport GTFS source
/// Indicates if the input GTFS contains On-Demand Transport (ODT) information
#[structopt(short = "t", long = "on-demand-transport")]
odt: bool,

/// OnDemandTransport GTFS comment
/// On-Demand Transport GTFS comment
#[structopt(long = "odt-comment")]
odt_comment: Option<String>,

/// name for the participant
/// Name for the participant
#[structopt(short, long)]
participant: String,

/// code for the provider of stops
/// Code for the provider of stops
#[structopt(short, long)]
stop_provider: Option<String>,

/// current datetime
/// Current datetime
#[structopt(
short = "x",
long,
Expand Down

0 comments on commit d4517ad

Please sign in to comment.