gtfs-to-fptf

Convert GFTS data to FPTF: lib & CLI.

Usage no npm install needed!

<script type="module">
  import gtfsToFptf from 'https://cdn.skypack.dev/gtfs-to-fptf';
</script>

README

gtfs-to-fptf

Convert GTFS data to FPTF: library and CLI.

Work in progress. This software is not stable yet. See the to-do section.

npm version dependency status dev dependency status license chat on gitter

Installation

CLI

npm install -g gtfs-to-fptf

Library

npm install --save gtfs-to-fptf

Usage

CLI

gtfs-to-fptf gtfs-directory fptf-directory

Library

toFPTF(gtfsDirectory, workingDirectory = null)

gtfsDirectory is the path to a directory containing .txt files, via the optional workingDirectory you can change where the scripts creates a temporary level db. Returns a Promise that will resolve in an object containing FPTF object streams.

Currently, the following GTFS files are supported:

  • agency.txt required
  • stops.txt required
  • routes.txt required
  • trips.txt required
  • stop_times.txt required
  • calendar.txt optional, required if calendar_dates.txt is not provided
  • calendar_dates.txt optional, required if calendar.txt is not provided
const toFPTF = require('gtfs-to-fptf')

toFPTF('./bus-gtfs/')
.then((fptf) => {
    fptf.stations.pipe(someStream)
    fptf.schedules.pipe(someOtherStream)
})

The FPTF object contains the following streams:

  • operators
  • stops
  • stations
  • lines
  • routes
  • schedules

To do

  • extended testing (there's probably still a lot of bugs)
  • improve error handling
  • dependency cleanup
  • tests

Contributing

If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.