Neapolitan Pasta Maker
Publish your own packages to the world's most popular software ecosystem with npm Pro.Get started »

build-cp-gtfs

0.1.3 • Public • Published

build-cp-gtfs

Build GTFS from the Comboios de Portugal 🇵🇹 (CP, Portugese Railways) REST API using the comboios JavaScript module. Inofficial, using CP endpoints. Ask them for permission before using this module in production.

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

npm version Build Status dependency status license chat on gitter

Installation

Library

npm install --save build-cp-gtfs

CLI

npm install -g build-cp-gtfs

Usage

Library

The script takes a startDate and an endDate JS Date() object (the feed will include the endDate, days will be calculated in Europe/Lisbon timezone) and return a Promise that will resolve in an object containing GTFS object streams:

const generateGTFS = require('build-cp-gtfs')
 
generateGTFS(new Date("2019-05-01"), new Date("2018-05-31"))
.then((gtfs) => {
    gtfs.routes.pipe(someStream)
    gtfs.stops.pipe(anotherStream)
})

The GTFS object contains the following streams:

  • agency
  • stops
  • routes
  • trips
  • stop_times
  • calendar_dates
  • feed_info

CLI

build-cp-gtfs start-date end-date directory
build-cp-gtfs 2019-05-01 2019-05-31 ~/cp-gtfs

To do

  • minify/optimize gtfs calendar_dates to calendar

See also

  • comboios - Comboios de Portgal API client in JavaScript
  • db-api-to-gtfs - Build GTFS from the Deutsche Bahn (DB, German Railways) REST API
  • european-transport-operators - List of european long-distance transport operators, available API endpoints, GTFS feeds and client modules.

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.

Install

npm i build-cp-gtfs

DownloadsWeekly Downloads

8

Version

0.1.3

License

ISC

Unpacked Size

13.3 kB

Total Files

5

Last publish

Collaborators

  • avatar