npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transxchange2gtfs

v1.10.4

Published

Converts transxchange data to GTFS

Downloads

63

Readme

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 [email protected]: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.