gtfs-to-leveldb

Import GFTS data into a LevelDB. Library and CLI tool.

Usage no npm install needed!

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

README

gtfs-to-leveldb

Import GTFS data into a LevelDB.

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
  • shapes.txt optional

npm version license chat on gitter

Installation

npm install gtfs-to-leveldb

Usage

From the command line

gtfs-to-leveldb <gtfs-directory> <path-to-leveldb>

Arguments:
    gtfs-directory   Input directory containing GTFS textfiles.
    path-to-leveldb  Path of the LevelDB that will be created/written to.

Options:
    --help       -h  Show this help message.
    --version    -v  Show the version number.

From JavaScript

const level = require('level')
const convert = require('gtfs-to-leveldb')

const db = level('my-db.ldb', {valueEncoding: 'json'})

convert('path-to-gtfs-dir', db)
.then((reader) => {
    return reader.route('123') // read route with ID `123`
})
.then(console.log)
.catch(console.error)

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.