Quick Start
#
Command Line UsageThe gtfs-to-html
command-line utility will download the GTFS file specified in config.js
and then build the HTML timetables and save them in html/:agency_key
.
If you would like to use this library as a command-line utility, you can install it globally directly from npm:
Then you can run gtfs-to-html
.
#
Command-line optionsconfigPath
Allows specifying a path to a configuration json file. By default, gtfs-to-html
will look for a config.json
file in the directory it is being run from.
skipImport
Skips importing GTFS into SQLite. Useful if you are rerunning with an unchanged GTFS file. If you use this option and the GTFS file hasn't been imported, you'll get an error.
#
Processing very large GTFS files.By default, node has a memory limit of 512 MB or 1 GB. If you have a very large GTFS file and want to use the option showOnlyTimepoint
= false
you may need to allocate more memory. Use the max-old-space-size
option. For example to allocate 2 GB:
#
Usage as a node moduleIf you are using this as a node module as part of an application, you can include it in your project's package.json
file.
#
Code example#
Example ApplicationAn example Express application that uses gtfs-to-html
is included in the app
folder. After an initial run of gtfs-to-html
, the GTFS data will be downloaded and loaded into SQLite.
You can view an individual route HTML on demand by running the included Express app:
By default, gtfs-to-html
will look for a config.json
file in the project root. To specify a different path for the configuration file:
Once running, you can view the HTML in your browser at localhost:3000
#
Usage as a hosted web appA hosted version of GTFS-to-HTML as a service allows you to use it entirely within your browser - no downloads or command line necessary.
It provides:
- a web-based interface for finding GTFS feeds or ability to enter your own URL
- support for adding custom configuration as JSON
- creation of HTML timetables as a downloadable .zip file
- a preview of all timetables generated directly in your browser
Currently, it is limited to relatively small GTFS files and doesn't offer support for Custom Templates.
#
TroubleshootingFailed to exec install script
#
SQLite3 unable to be installed with For an error like:
lifecycle sqlite3@5.0.0~install: Failed to exec install script
Try installing gtfs-to-html
using the following flags:
npm install --unsafe-perm --allow-root -g