TripSearch

TripSearch

Trip Search

This Class sets the parameters and options of a Trip Search: a search of the GTFS schedule data finding trips (direct and/or with transfers) from the origin Stop to the destination Stop at the specified time with the specified options.

Module: search/TripSearch

Constructor

new TripSearch(origin, destination, departureopt, optionsopt)

Source:

Set the parameters of a new Trip Search

Parameters:
Name Type Attributes Default Description
origin Stop

Origin Stop

destination Stop

Destination Stop

departure DateTime <optional>
now

The Departure Date/Time of the Trip Search

options Object <optional>

Trip Search Options

Properties
Name Type Attributes Default Description
allowTransfers boolean <optional>
true

Allow transfers between trains

allowChangeInDirection boolean <optional>
true

Allow transfers that change direction of travel

preDepartureHours int <optional>
3

The number of hours before the requested departure to include in results

postDepartureHours int <optional>
6

The number of hours after the requested departure to include in results

maxLayoverMins int <optional>
30

The maximum number of minutes to layover at a transfer Stop

minLayoverMins int <optional>
0

The minimum number of minutes to layover at a transfer Stop

maxTransfers int <optional>
2

The maximum number of transfers

Members

allowChangeInDirection :boolean

Source:
Default Value:
  • true

Allow Transfers between trains operating in opposite directions

Type:
  • boolean

allowTransfers :boolean

Source:
Default Value:
  • true

Allow Transfers between Trains

Type:
  • boolean

departure :DateTime

Source:
Default Value:
  • now

Trip Search Departure Date/Time

Type:

destination :Stop

Source:

Trip Search Destination Stop

Type:

maxLayoverMins :int

Source:
Default Value:
  • 30

The maximum number of minutes between trips at a layover

Type:
  • int

maxTransfers :int

Source:
Default Value:
  • 2

The maximum number of transfers for a single result

Type:
  • int

minLayoverMins :int

Source:
Default Value:
  • 0

The minimum number of minutes between trips at a layover

Type:
  • int

options

Source:

All of the Trip Search options

origin :Stop

Source:

Trip Search Origin Stop

Type:

postDepartureHours :int

Source:
Default Value:
  • 6

The number of hours after the departure time to include in results

Type:
  • int

preDepartureHours :int

Source:
Default Value:
  • 3

The number of hours before the departure time to include in results

Type:
  • int

Methods

Source:

Perform the trip search on the provided Right Track Database

Parameters:
Name Type Description
db RightTrackDB

The Right Track DB to query

callback function

Callback function

Properties
Name Type Attributes Description
err Error

Database Query Error

results Array.<TripSearchResult> <optional>

Trip Search Results