Constructor
new TimetablesManager()
Loads database, allowing for easy querying with supplied methods
Example
```javascript
const {TimetablesManager, BODSClient} = require("bodsjs");
await BODSClient.downloadTimetableData('england');
let timetables = new TimetablesManager();
Members
Agencies
Agencies database access
Routes
Routes database access
Shapes
Route Shapes database access
StopTimes
StopTimes database access
Stops
Stops database access
Trips
Trips database access
Methods
(async) getAgenciesByName(substring) → {Promise.<Array.<Agency>>}
Searches for agencies with a name containing a substring
Parameters:
Name | Type | Description |
---|---|---|
substring |
String | The string to search for |
Returns:
An array of found agencies
- Type
- Promise.<Array.<Agency>>
(async) getAgencyById(ID) → {Promise.<Agency>}
Gets the agency by its ID
Parameters:
Name | Type | Description |
---|---|---|
ID |
String |
Returns:
The agency with this ID
- Type
- Promise.<Agency>
(async) getAgencyByNOC(noc) → {Promise.<Agency>}
Gets an agency from its National Operator Code
Parameters:
Name | Type | Description |
---|---|---|
noc |
String | The National Operator Code to search for |
Returns:
The agency with this National Operator Code
- Type
- Promise.<Agency>
(async) getCalendarDatesFromServiceID(id) → {Promise.<Array.<Calendar>>}
Get a list of Calendar Date entries from their Service IDs
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The service ID to look for |
Returns:
- Type
- Promise.<Array.<Calendar>>
(async) getCalendarEntryFromServiceID(id) → {Promise.<Calendar>}
Get a Calendar entry from their Service IDs
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The service ID to look for |
Returns:
- Type
- Promise.<Calendar>
(async) getRouteById(id) → {Promise.<Route>}
Finds a route from its route ID
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The ID to search for |
Returns:
The route with this ID
- Type
- Promise.<Route>
(async) getRoutesByName(name) → {Promise.<Array.<Route>>}
Gets routes by short name
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the route (E.G X17) |
Returns:
The routes that match this name
- Type
- Promise.<Array.<Route>>
(async) getShapeById(id) → {Promise.<Shape>}
Gets a Shape (array of ShapePoints) by its ID
Parameters:
Name | Type | Description |
---|---|---|
id |
String | The ID of the whole shape |
Returns:
- Type
- Promise.<Shape>
(async) getStopByCode(code) → {Promise.<Stop>}
Gets the stop by its code (often printed on signage at the stop)
Parameters:
Name | Type | Description |
---|---|---|
code |
String | The code to search for |
Returns:
The stop with this code
- Type
- Promise.<Stop>
(async) getStopById(id) → {Promise.<Stop>}
Gets a stop by its ID
Parameters:
Name | Type | Description |
---|---|---|
id |
String | The ID of the stop |
Returns:
The Stop with this ID
- Type
- Promise.<Stop>
(async) getStopTimesByStop(id) → {Promise.<Array.<StopTime>>}
Gets a list of StopTimes by the stop the buses use
Parameters:
Name | Type | Description |
---|---|---|
id |
String | The ID of the stop to look for |
Returns:
An array of different StopTimes
- Type
- Promise.<Array.<StopTime>>
(async) getStopTimesByTrip(id) → {Promise.<Array.<StopTime>>}
Gets a list of StopTimes by their trip_id
Parameters:
Name | Type | Description |
---|---|---|
id |
String | The ID of the trip to look for |
Returns:
An array of different StopTimes
- Type
- Promise.<Array.<StopTime>>
(async) getStopsByBounds(boundingBox) → {Promise.<Array.<Stop>>}
Get all stops within an area using a Bounding Box
Parameters:
Name | Type | Description |
---|---|---|
boundingBox |
BoundingBox | A BoundingBox that specifies an area to look in |
Returns:
A list of stops within the area
- Type
- Promise.<Array.<Stop>>
(async) getStopsByStation(parent) → {Promise.<Array.<Stop>>}
Gets all stops by their parent station stop ID.
This (probably) won't work for every station.
Parameters:
Name | Type | Description |
---|---|---|
parent |
String | ID of the parent stop |
Returns:
The list of stops within the station
- Type
- Promise.<Array.<Stop>>
(async) getTripById(id) → {Promise.<Trip>}
Get a trip by its ID
Parameters:
Name | Type | Description |
---|---|---|
id |
String | The trip ID |
Returns:
The trip with this ID
- Type
- Promise.<Trip>
(async) getTripsFromRouteID(id) → {Promise.<Array.<Trip>>}
Get a list of trips from their Route IDs
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The Route ID this trip runs on |
Returns:
A list of trips
- Type
- Promise.<Array.<Trip>>