
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
tfl-journey-planner
Advanced tools
A simple Node wrapper for the for fetching real-time journey's from the TFL API
npm install tfl-journey-planner --save
tflJourneyPlanner = require('tfl-journey-planner');
// Specify locations in this format
locations = {
to: {lat: 51.5002452, lng: 0.0035842},
from: {lat: 51.5131652, lng: -0.0905267}
};
options = {}; // Specify additional options if you want (see below)
tflJourneyPlanner(locations, options, function(results){
console.log(results); // Do awesome stuff with the TFL results!
});
Locations can either be specified like:
locations = {
to: {lat: 51.5002452, lng: 0.0035842},
from: {lat: 51.5131652, lng: -0.0905267}
}
or with their text value
locations = {
to: 'Aldgate East',
from: 'London Bridge'
};
However, using text values will more than likley have many matches, so your response may not be as you'd planned.
or with postal codes/ text addresses
locations = {
to: 'SE18 7PH',
from: 'EC3M 3AD'
};
The second param is a JSON object where you can put any of the following (all are optional):
| OPTION | DEFAULT | EXPLINATION |
|---|---|---|
| via | Travel through (if in coordinate format then must be "longitude,latitude") | |
| nationalSearch | [False] | Does the journey cover stops outside London? eg. "nationalSearch=true" |
| date | The date must be in yyyyMMdd format | |
| time | The time must be in HHmm format | |
| timeIs | [Departing] | Does the time given relate to arrival or leaving time? Possible options: "departing" |
| journeyPreference | [LeastTime] | The journey preference eg possible options: "leastinterchange" |
| mode | The mode must be a comma separated list of modes. eg possible options: "public-bus,overground,train,tube,coach,dlr,cablecar,tram,river,walking,cycle" | |
| accessibilityPreference | The accessibility preference must be a comma separated list eg. "noSolidStairs,noEscalators,noElevators,stepFreeToVehicle,stepFreeToPlatform" | |
| fromName | From name is the location name associated with a from coordinate | |
| toName | To name is the label location associated with a to coordinate | |
| viaName | Via name is the location name associated with a via coordinate. | |
| maxTransferMinutes | The max walking time in minutes for transfer eg. "120" | |
| maxWalkingMinutes | The max walking time in minutes for journeys eg. "120" | |
| walkingSpeed | [Average] | The walking speed. eg possible options: "slow" |
| cyclePreference | [None] | The cycle preference. eg possible options: "allTheWay" |
| adjustment | Time adjustment command. eg possible options: "TripFirst" | |
| bikeProficiency | A comma separated list of cycling proficiency levels. eg possible options: "easy,moderate,fast" | |
| alternativeCycle | [False] | Option to determine whether to return alternative cycling journey |
| alternativeWalking | [True] | Option to determine whether to return alternative walking journey |
| applyHtmlMarkup | [False] | Flag to determine whether certain text (e.g. walking instructions) should be output with HTML tags or not. |
| useMultiModalCall | [False] | A boolean to indicate whether or not to return 3 public transport journeys, a bus journey, a cycle hire journey, a personal cycle journey and a walking journey |
| walkingOptimization | [False] | A boolean to indicate whether to optimize journeys using walking |
Specify options like this:
options = {
walkingOptimization: true,
bikeProficiency: 'easy',
accessibilityPreference: 'noEscalators'
}
Written in LiveScript, run npm run build to build, or npm run watch to watch for changes then build
npm test
Report on GitHub repo issue page
Authentication is not required any longer or tfl requests. If you do need to authenticate then you can sign up for an API key at https://api-portal.tfl.gov.uk/signup Create a JSON object similar to the one below
tfl = {
appId: 'xxxxxxxx',
appKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
};
FAQs
A node js wrapper for the TFL journey planner API
The npm package tfl-journey-planner receives a total of 8 weekly downloads. As such, tfl-journey-planner popularity was classified as not popular.
We found that tfl-journey-planner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.