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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gtfs-2

v0.0.6

Published

Forked from gtfs-node. Download GTFS transit data into mongodb and expose routes, stops, times and more

Downloads

7

Readme

#Node-GTFS

node-GTFS loads transit data in GTFS format from GTFS Data Exchange, unzips it and stores it to a MongoDB database and provides some methods to query for agencies, routes, stops and times. It also has spatial queries to find nearby stops, routes and agencies.

##Configuration for loading data

Before you can use node-GTFS you must specify agencies to download from GTFS Data Exchange. You need the dataexchange_id for each agency you want to include from GTFS Data Exchange - it is in the URL of each individual transit agency's page.

A full list of agencies is available via the GTFS Data Exchange API.

For example, Austin Capital Metro is capital-area-transit, Washington DC is wmata.

Add the list of agency keys you'd like to support to config.js as an array called agencies

The mongodb URI is also configured in config.js

###To load data

node ./scripts/download

To keep schedules up to date, you might want to schedule this to occur once per day.

##Example Application

There is an example web app that creates some restful API endpoints and has a simple frontend for viewing transit data. It is in examples/express. You could load the example site with:

node ./examples/express/index.js

##Endpoints

###List agencies

/api/agencies

###List agencies near a point

/api/agenciesNearby/:lat/:lon/:radius

//Example
/api/agenciesNearby/37.73/-122.25/10

:radius is optional and in miles. Default: 25 miles Returns all agencies that serve the 100 nearest stops within the specified radius

###List routes for an agency

/api/routes/:agency

//Example
/api/routes/san-francisco-municipal-transportation-agency

###List routes near a point

/api/routesNearby/:lat/:lon/:radius

//Example
/api/routesNearby/37.73/-122.25/0.25

:radius is optional and in miles. Default: 1 mile Returns all routes that stop at the 100 nearest stops within the specified radius

###List stops for a route

/api/stops/:agency/:route_id/:direction_id

//Example
/api/stops/san-francisco-municipal-transportation-agency/34/1

:direction_id is optional

###List stops near a point

/api/stopsNearby/:lat/:lon/:radius

//Example
/api/StopsNearby/37.73/-122.25/0.25

:radius is optional and in miles. Default: 1 mile Returns the 100 nearest stops within the specified radius

###List stop times for a stop

/api/times/:agency/:route_id/:stop_id/:direction_id

//Example
/api/times/san-francisco-municipal-transportation-agency/34/1256/0

:direction_id is optional

##Hosting the Example App with Heroku and MongoHQ

A Procfile is already in the repo pointing to the example app in examples/express.

Create app on Heroku

$ heroku apps:create YOURAPPNAME

Add MongoHQ to your app

$ heroku addons:add mongohq:sandbox

MONGOHQ creates a user, database and exports it as a MONGOHQ_URL environment variable.

Push your app to Heroku

$ git push heroku master

Execute the download script to populate the database with the agency data specified in config.js

$ run node ./scripts/download

##Pulling in updated transit data

Re-run the download script whenever you need to refresh the database.

$ npm run node ./scripts/download

License

(The MIT License)

Copyright (c) 2012 Brendan Nee [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.