transxchange2gtfs
TypeScript icon, indicating that this package has built-in type declarations

1.10.4 • Public • Published

transxchange2gtfs

Travis npm David

transxchange2gtfs converts TransXChange timetable data into a GTFS zip.

Comparison

There are other similar projects, each with their own merits. This tool has some features not found in the others:

  • Smaller output - identical calendars are reused
  • Better handling of bank holidays
  • Built in NaPTAN data (stop names, longitude, latitude)
  • Ability to process multiple files, including zips
  • Low memory usage - most large files use less than 1GB, processing the entire UK data set requires 2GB
  • Generates interchange time and transfers to nearby stops

Installation

Please note that zip/unzip and node 14.x or above are required. As zip/unzip are required this program will not currently run on Windows.

transxchange2gtfs is a CLI tool that can be installed via NPM:

npm install -g transxchange2gtfs

or used directly with npx:

npx transxchange2gtfs ...

Usage

It can be run by specifying the input and output files as CLI arguments:

transxchange2gtfs transxchange1.xml transxchange2.xml gtfs-output.zip

Or using zip files:

transxchange2gtfs multiple-transxchange-files.zip /path/*.zip single-transxchange.xml gtfs-output.zip

Prior to version 1.9.0 nested zip files we're ignored. They are now processed recursively.

On occasion, a large dataset will cause a heap out of memory issue. In this case, set the NODE_OPTIONS environment variable to increase the heap size. For example to set to 8GiB, in a linux shell:

NODE_OPTIONS=--max-old-space-size=8192 transxchange2gtfs transxchange.zip gtfs-output.zip

It's possible to set the default agency URL, language and timezone:

AGENCY_URL=http://agency.com AGENCY_TIMEZONE=Europe/London AGENCY_LANG=en transxchange2gtfs transxchange.zip gtfs-output.zip

On first run transxchange2gtfs will download the latest Stop data from NaPTAN. If you would like to force a refresh of the data add --update-stops. Alternatively you can skip downloading the stop data by adding --skip-stops.

transxchange2gtfs --update-stops  transxchange.zip gtfs-output.zip

Requirements

Node.js version >= 12 is required.

Notes

  • All stop times are left in the original timezones (assumed to be local time).
  • It is assumed that any stops in different TransXChange documents with the same ATCO are the same stop.
  • Stop data is derived from NaPTAN.
  • TransXChange is a bizarre and over-engineered standard, there are probably edge cases that have not been covered.
  • A MySQL for the GTFS files is provided in the resource folder, along with an import script.

Contributing

Issues and PRs are very welcome. To get the project set up run

git clone git@github.com:planarnetwork/transxchange2gtfs
npm install --dev
npm test

If you would like to send a pull request please write your contribution in TypeScript and if possible, add a test.

License

This software is licensed under GNU GPLv3.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.10.41latest

Version History

VersionDownloads (Last 7 Days)Published
1.10.41
1.10.30
1.10.21
1.10.10
1.10.00
1.9.23
1.9.10
1.9.00
1.8.80
1.8.70
1.8.60
1.8.50
1.8.40
1.8.30
1.8.20
1.8.10
1.8.00
1.7.20
1.7.10
1.7.00
1.6.21
1.6.10
1.6.00
1.5.00
1.4.20
1.4.10
1.4.00
1.3.10
1.3.00
1.2.30
1.2.10
1.2.00
1.1.00
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.01
0.1.10
0.1.00

Package Sidebar

Install

npm i transxchange2gtfs

Weekly Downloads

7

Version

1.10.4

License

GPL-3.0

Unpacked Size

391 kB

Total Files

69

Last publish

Collaborators

  • linusnorton