#gtfs #geo-json #transport

bin+lib gtfs-geojson

A simple converter for GTFS to GeoJSON formats

6 releases (3 breaking)

0.5.0 Feb 29, 2024
0.3.1 Nov 9, 2022
0.3.0 Jul 29, 2021
0.2.0 Jul 27, 2021
0.1.1 May 27, 2020

#336 in Data structures

Download history 17/week @ 2024-07-29 2/week @ 2024-09-23

104 downloads per month

MIT license

20KB
263 lines

GTFS to GeoJson

This Rust crate is used to convert GTFS data to the GeoJSON format.

Installing Crate

Crate

While the repo is named gtfs-to-geojson the crate is called gtfs_geojson and can me installed using

cargo add gtfs_geojson

Functions

The gtfs_geojson library use the gtfs_structures library and its types to convert gtfs files over to geojson.

extract_stops(&gtfs: &gtfs_structures::Gtfs) -> Vec

extract_stops will export all of the stops and their properties from the gtfs.

extract_trips_shapes(&gtfs: &gtfs_structures::Gtfs) -> Vec

extract_trips_shapes will export all of the shapes as line features from the shapes.txt file and add in trip information for each feature in the geojson properties from trips.txt.

How to compile and run the standalone program

  • Clone this repository
  • Install Rust
  • Run the tests with cargo test --all-features (see GitHub actions setup)
  • Build the optimized binary with cargo build --release
  • Run the standalone program with cargo run --release -- --help
  • To run the standalone program without cargo (e.g. when shipping the binary), run target/release/gtfs-geojson --help

Dependencies

~12MB
~206K SLoC