Right Track Transit Agency (Abstract)
node module: right-track-transit
GitHub repo: right-track/right-track-transit
This is an abstract Right Track Transit Agency. This module provides the
abstract RightTrackTransitAgency
class which is extended by an implementing
Right Track Transit Agency.
This module also includes the Transit Feed Classes: TransitFeed
, TransitDivision
,
and TransitEvent
, which are all required when a Transit Agency implements the real-time
Transit Feed functionality.
Documentation
Documentation can be found in the /doc/ directory of this repository or online at https://docs.righttrack.io/right-track-transit.
Supported Agencies
The following are Right Track Transit Agencies that implement this abstract class:
Transit Feed
A Transit Feed provides a list of real-time transit events. A Transit Feed is broken down into a hierarchical system where a single Transit Feed includes one or more Divisions, which in turn includes either one or more child Divisions or a list of Events (which contain the real-time transit status information).
To load an agency-specific TransitFeed
, use the loadFeed(callback)
function where:
-
callback
is a callback function:function(err, feed)
- accepting an
Error
andTransitFeed
as arguments.
- accepting an
See the Documentation for more information on the structure of a TransitFeed
.
Example
The following example uses the right-track-transit-mta module to build a Transit Feed for the Metropolitan Transportation Authority.
const mta = require('right-track-transit-mta');
mta.loadFeed(function(err, feed) {
if ( !err ) {
console.log(JSON.stringify(feed, null, 2));
}
});