Configuration Options
GTFS-to-HTML reads its configuration from a JSON file. To get started, copy config-sample.json
to config.json
and then add your project's configuration to config.json
.
Ensure that your config.json is valid JSON before proceeding.
note
All files starting with config*.json
are .gitignored - so you can create multiple configuration files such as config-caltrain.json
.
option | type | description |
---|---|---|
agencies | array | An array of GTFS files to be imported. |
allowEmptyTimetables | boolean | Whether or not to generate timetables that have no trips. |
beautify | boolean | Whether or not to beautify the HTML output. |
coordinatePrecision | integer | Number of decimal places to include in geoJSON map output. |
dateFormat | string | A string defining date format in moment.js style. |
dayShortStrings | array of strings | An array defining contractions of weekdays names from Monday to Sunday. |
dayStrings | array of strings | An array defining weekdays names from Monday to Sunday. |
debug | boolean | Enable logging of SQL queries and other info. |
defaultOrientation | string | Specify timetable orientation, when not specified in timetables.txt . |
effectiveDate | string | A date to print at the top of the timetable. |
interpolatedStopSymbol | string | The symbol used to indicate that a timepoint isn't fixed, but just interpolated. |
interpolatedStopText | string | The text used to describe a timepoint isn't fixed, but just interpolated. |
linkStopUrls | boolean | Whether or not to hyperlink timetable stop names to the stop_url defined in stops.txt . |
logFunction | function | A custom logging function for handling output of logs. |
mapboxAccessToken | string | The Mapbox access token for generating a map of the route. |
menuType | string | The type of menu to use for selecting timetables on a timetable page. |
noDropoffSymbol | string | The symbol used to indicate ta stop where no drop off is available. |
noDropoffText | string | The text used to describe a stop where no drop off is available. |
noHead | boolean | Whether or not to skip the header and footer of the HTML document. |
noServiceSymbol | string | The symbol used when a specific trip does not serve a specified stop. |
noServiceText | string | The text used to describe a stop which is not served by a specific trip. |
outputFormat | string | The file format of the timetables generated. Either html or pdf . |
noPickupSymbol | string | The symbol used to indicate a stop where no pickup is available. |
noPickupText | string | The text used to describe a stop where no pickup is available. |
requestDropoffSymbol | string | The symbol used to indicate a stop where riders must request a drop off. |
requestDropoffText | string | The text used to describe a stop where riders must request a drop off. |
requestPickupSymbol | string | The symbol used to indicate a stop where riders must request a pickup. |
requestPickupText | string | The text used to describe a stop where riders must request a pickup. |
serviceNotProvidedOnText | string | The text used to label days where service is not provided. |
serviceProvidedOnText | string | The text used to label days where service is provided. |
showArrivalOnDifference | float | Defines a difference between departure and arrival, on which arrival column/row will be shown. |
showMap | boolean | Whether or not to show a map of the route on the timetable. |
showOnlyTimepoint | boolean | Whether or not all stops should be shown, or only stops with a timepoint value in stops.txt . |
showRouteTitle | boolean | Whether or not to show the route title at the top of the timetable page. |
showStopCity | boolean | Whether or not to show each stop's city. |
showStopDescription | boolean | Whether or not to show a stop description. |
skipImport | boolean | Whether or not to skip importing GTFS data into SQLite. |
sortingAlgorithm | string | Defines the trip-sorting algorithm. |
sqlitePath | string | A path to an SQLite database. Optional, defaults to using an in-memory database. |
templatePath | string | Path to custom pug template for rendering timetable. |
timeFormat | string | A string defining time format in moment.js style. |
useParentStation | boolean | Whether or not to use a stop's parent_station . |
verbose | boolean | Whether or not to print output to the console. |
zipOutput | boolean | Whether or not to zip the output into one zip file. |
#
agencies{Array} Specify the GTFS files to be imported in an agencies
array. GTFS files can be imported via a url
or a local path
.
Each file needs an agency_key
, a short name you create that is specific to that GTFS file. For GTFS files that contain more than one agency, you only need to list each GTFS file once in the agencies
array, not once per agency that it contains.
To find an agency's GTFS file, visit transitfeeds.com. You can use the URL from the agency's website or you can use a URL generated from the transitfeeds.com API along with your API token.
- Specify a download URL:
- Specify a path to a zipped GTFS file:
- Specify a path to an unzipped GTFS file:
- Exclude files - if you don't want all GTFS files to be imported, you can specify an array of files to exclude.
- Optionally specify a proj4 projection string to correct poorly formed coordinates in the GTFS file
- Specify multiple agencies to be imported. Note that it is often better to have one configuration file per agency and call gtfs-to-html multiple times rather than have two different agencies in the same config file. If agencies have conflicting ids for routes, stops, calendars or more, GTFS-to-HTML will fail.
#
allowEmptyTimetables{Boolean} Whether or not to generate empty timetables that have no trips. Defaults to false
.
#
beautify{Boolean} Whether or not to beautify the HTML output. Defaults to false
.
#
coordinatePrecision{Integer} The number of decimal places to include in the latitude and longitude of coordinates in GeoJSON used in maps. Omit to avoid any rounding. 5
is a reasonable value (about 1.1 meters).
#
dateFormat{String} A string defining date format using moment.js tokens. See full list of formatting options. Defaults to MMM D. YYYY
which yields "Apr 5, 2022".
#
daysShortStrings{Array [String]} An array of strings defining contractions of weekday names. Specify from Monday to Sunday.
#
daysStrings{Array [String]} An array of strings defining contractions of weekday names. Specify from Monday to Sunday.
#
debug{Boolean} Whether or not to enable loggin of SQL queries and other info. Defaults to false.
#
defaultOrientation{String} Specifies timetable orientation, when not mentioned in timetables.txt
. Valid options are vertical
, horizontal
or hourly
. For details, see timetables.txt
orientation
specification.
#
effectiveDate{String} This is printed at the top of the timetable.
#
interpolatedStopSymbol{String} The symbol used to indicate that a timepoint isn't fixed, but just interpolated. Defaults to •
. To avoid having this symbol used in timetables, set it to null
.
#
interpolatedStopText{String} The text used to describe that a timepoint isn't fixed, but just interpolated. Defaults to Estimated time of arrival
.
#
linkStopUrls{Boolean} Whether or not to hyperlink timetable stop names to the stop_url
defined in stops.txt
. If no stop_url
is defined for a stop, no link will be created. Defaults to false
.
#
logFunction{Function} If you want to route logs to a custom function, you can pass a function that takes a single text
argument as logFunction
. This can't be used when running GTFS-to-HTML as a command-line utility, only when included as part of a node.js app and passed in a config object to gtfsToHtml()
. For example:
#
mapboxAccessToken{String} The Mapbox access token for generating a map of the route.
#
menuType{String} The type of menu to use for selecting or navigating to timetables on timetable pages with multiple timetables. Valid choices are none
, simple
, jump
and radio
. Defaults to simple
.
#
noDropoffSymbol{String} The symbol used to indicate that no drop off is available at a stop. Defaults to ‡
. To avoid having this symbol used in timetables, set it to null
.
#
noDropoffText{String} The text used to describe that no drop off is available at a stop. Defaults to No drop off available
.
#
noHead{Boolean} Whether or not to skip the HTML head and footer when generating the HTML. This is useful for creating embeddable HTML without <html>
, <head>
or <body>
tags. Defaults to false
. Ignored if outputFormat
is set to pdf
.
#
noPickupSymbol{String} The symbol used to indicate that no pickup is available at a stop. Defaults to **
. To avoid having this symbol used in timetables, set it to null
.
#
noPickupText{String} The text used to describe that no pickup is available at a stop. Defaults to No pickup available
.
#
noServiceSymbol{String} The symbol used when a specific trip does not serve a specified stop. Defaults to -
. To avoid having this symbol used in timetables, set it to null
.
#
noServiceText{String} The text used to describe when a specific trip does not serve a specified stop. Defaults to No service at this stop
.
#
outputFormat{String} The file format of the timetables generated. Either html
or pdf
. Defaults to html
.
#
requestDropoffSymbol{String} The symbol used to indicate that riders must request to be dropped off at a stop. Defaults to â€
. To avoid having this symbol used in timetables, set it to null
.
#
requestDropoffText{String} The text used to describe that riders must request to be dropped off at a stop. Defaults to Must request drop off
.
#
requestPickupSymbol{String} The symbol used to indicate that riders must request pickup at a stop. Defaults to ***
. To avoid having this symbol used in timetables, set it to null
.
#
requestPickupText{String} The text used to describe that riders must request pickup at a stop. Defaults to Request stop - call for pickup
.
#
serviceNotProvidedOnText{String} The text used to label days where service is not provided. Defaults to Service not provided on
.
#
serviceProvidedOnText{String} The text used to label days where service is provided. Defaults to Service provided on
.
#
showArrivalOnDifference{Float} Whether or not to show an arrival column/row in the timetable. It means, that if on at least one stop difference (stay on that stop) is equal or greater than specified here, the arrival time will be shown. Use 0
to show on each stop or null
to supress for showing arrival at all.
#
showMap{Boolean} Whether or not to show a map of the route on the timetable. Defaults to false
.
If you'd rather just get all stops and route info as geoJSON, see gtfs-to-geojson.
#
showOnlyTimepoint{Boolean} Whether or not all stops should be shown, or only stops with a timepoint
value in stop_times.txt that is considered exact (i.e. empty or 1
). Defaults to false
, all stops shown.
#
showRouteTitle{Boolean} Whether or not to show the route title at the top of the timetable page. Defaults to true
, showing the route title.
#
showStopCity{Boolean} Whether or not to show the city for each stop. City is determined by the stop_city
field in the non-standard stop_attributes.txt
. Only has an effect when the timetable's orientation
is horizontal
or hourly
. Defaults to false
.
#
showStopDescription{Boolean} Whether or not to show a stop description for each stop. Stop description is taken from the stop_desc
field instops.txt
. Defaults to false
.
#
skipImport{Boolean} Whether or not to skip importing from GTFS into SQLite. Useful for re-running the script if the GTFS data has not changed. If you use this option and the GTFS file hasn't been imported or you don't have an sqlitePath
to a non-in-memory database specified, you'll get an error. Defaults to false
.
#
sortingAlgorithm{String} Defines trip-sorting algorithm. There are two main groups of algorithms: simplified and full.
Simplified algorithms sort trips by using one specific stop.
common
finds a coommon stop (used by all trips) (if not foundfirst
is used).first
uses the first stop stop on the longest triplast
uses the last stop on the longest trip
Full algorithms sorting usinig every stop on the route. If there is no time specified, the trip will remain in its previous place.
beginning
sorts from beginning to endend
sorts from end to beginning
The default trip-sorting algorithm is common
.
#
sqlitePath{String} A path to an SQLite database. Optional, defaults to using an in-memory database with a value of :memory:
. If you want the data imported to persist, you need to specify a value for sqlitePath
#
templatePath{String} Path to a folder containing (pug)[https://pugjs.org/] template for rendering timetables. This is optional. Defaults to using the templates provided in views/default
. All files within the /views/custom
folder will be .gitignored, so you can copy the views/default
folder to views/custom/myagency
and make any modifications needed. Any custom views folder should contain pug templates called timetablepage.pug
, timetablepage_full.pug
, overview.pug
, and overview_full.pug
.
#
timeFormat{String} A string defining time format using moment.js tokens. See full list of formatting options. Defaults to h:mma
which yields "8:36pm".
#
useParentStation{Boolean} Whether or not to use the parent_station
of a stop, if specified instead of the platform or boarding area. Useful if different trips for the same route have different platforms that you want to show up in the timetable as separate stops. Defaults to true
.
#
verbose{Boolean} If you don't want the import script to print any output to the console, you can set verbose
to false
. Defaults to true
.
#
zipOutput{Boolean} Whether or not to zip the output into one zip file named timetables.zip
. Defaults to false
.