Skip to content

public-transport/sample-gtfs-feed

Repository files navigation

sample-gtfs-feed

An imaginary GTFS Schedule dataset used for testing.

npm version ISC-licensed support me via GitHub Sponsors chat with me on Twitter

Installing

npm install sample-gtfs-feed

Usage

Using following GTFS tables, sample-gtfs-feed forms a GTFS feed for a simple fictional transit network:

plain CSV files

The sample-gtfs-feed npm package contains plain CSV files, which you can process like any GTFS feed.

To get the path to one of these files in Node.js, use require.resolve:

fs.readFileSync(require.resolve('sample-gtfs-feed/gtfs/agency.txt'), {
	encoding: 'utf8'
})

To get the path from the command line, use node -p:

cat $(node -p 'require.resolve("sample-gtfs-feed/gtfs/agency.txt")')
agency_id,agency_name,agency_url,agency_timezone,agency_lang,agency_phone,agency_fare_url,agency_email
FTA,Full Transit Agency,https://fta.example.org/,Europe/Warsaw,de,+49 123 456 789 0,https://fta.example.org/fares.html,contact@fta.example.org
MTA,Minimal Transit Agency,https://mta.example.org/,Europe/Berlin,,,,

There's also a .zip file of these plain CSV files available as sample-gtfs-feed/gtfs.zip.

JSON files

cat $(node -p 'require.resolve("sample-gtfs-feed/json/agency.json")')

JS objects

require('sample-gtfs-feed/agency')
[{
	agency_id: 'FTA',
	agency_name: 'Full Transit Agency',
	agency_url: 'https://fta.example.org/',
	agency_timezone: 'Europe/Warsaw',
	agency_lang: 'de',
	agency_phone: '+49 123 456 789 0',
	agency_fare_url: 'https://fta.example.org/fares.html',
	agency_email: 'contact@fta.example.org'
}, {
	agency_id: 'MTA',
	agency_name: 'Minimal Transit Agency',
	agency_url: 'https://mta.example.org/',
	agency_timezone: 'Europe/Berlin'
}]

Contributing

If you have a question or have difficulties using sample-gtfs-feed, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.