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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gtfsmerge

v4.4.0

Published

Merge GTFS data sets

Readme

gtfsmerge

npm

gtfsmerge merges multiple GTFS feeds into a single one.

  • Transfers are created between stops close enough to walk between
  • Duplicate stops, agencies and routes are assumed to be the same and written once
  • Calendars, calendar dates, routes, trips and stop times are re-indexed
  • Identical calendars are merged into a single entry
  • Calendars and calendar dates in the past are removed, along with their trips
  • A calendar date with no calendar has one synthesised for it
  • Unused stops are removed, and a transfer to one goes with it
  • A call at a platform becomes a call at the station above it
  • A transfer_type 4 coupling is carried through, pointing at the renumbered trips
  • Routes can be removed based on their type (bus, rail, etc)
  • Fares files are not processed. Please raise an issue if you would like this feature

Installation

npm install -g gtfsmerge

Requires node 22 or above. No zip binary is needed — the archive is written in process.

Usage

Every argument but the last is a feed to merge; the last is where the merged feed goes, as a .zip or a directory:

gtfsmerge input1.zip input2.zip output.zip

The distance in kilometres within which transfers are generated for nearby stops:

gtfsmerge --transfer-distance 2 input1.zip input2.zip output.zip

A column a feed carries that the merge does not write of its own is passed through as the feed wrote it, after the merge's own columns - the rail feed's transfers say which mode a fixed link is and when it runs, and those arrive in the merged feed. A column only one of the feeds has is empty in the rows of the others. A column naming something the merged feed does not have is not passed through: a transfer's route ids, which the merge renumbers, and level_id, network_id and the flexible services' locations and booking rules, whose files it does not write.

Stops with the same id in different feeds are assumed to be the same stop, and there is no way to say otherwise. A GB rail feed from cif2gtfs and a GB bus feed from transxchange2gtfs both name a stop by its ATCO code, so they merge without any reconciliation. Feeds that disagree about what an id means have to be reconciled before they get here.

Routes can be removed based on their type:

gtfsmerge --remove-route-types 0,1,4 input1.zip input2.zip output.zip

Anything that finished before today is dropped. --no-date-filter keeps it all; --date-filter 20260601 pins the cutoff, which is what you want for a reproducible merge:

gtfsmerge --date-filter 20260601 input1.zip input2.zip output.zip

Generated transfer distances use a flat-earth approximation calibrated at one latitude, 54 by default, which is the middle of Great Britain. Elsewhere:

gtfsmerge --ruler-latitude 40 input1.zip input2.zip output.zip

gtfsmerge --help lists everything.

Memory

A whole feed is held in memory while it is merged, so bin/gtfsmerge.sh runs node with --max-old-space-size=8000. stop_times.txt is the only file that has to be buffered, and only because the stop times cannot be renumbered until the trips have been — a two pass read would remove the largest allocation in the tool.

Contributing

This lives in the dtd2mysql monorepo. See its README for how to run the tests.

fixtures/tiny is two hand-written feeds covering the edges that merging two real feeds does not reach, and fixtures/tiny/golden is what they merge to, committed as text so a change in behaviour arrives as a readable diff. UPDATE_GOLDEN=1 yarn vitest run regenerates it; every movement needs an entry in fixtures/BASELINE.md, and CI checks that it has one.

License

This software is licensed under GNU GPLv3.