Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

public-transport/gtfs-to-leveldb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.