-
Notifications
You must be signed in to change notification settings - Fork 2
API documentation
Axel Niklasson edited this page Aug 26, 2017
·
1 revision
Just load the module and start using the functions!
var nodeSkanetrafiken = require('node-skanetrafiken');
Find stops matching a query.
Options parameters
- name - query for stop name (string) - required
nodeSkanetrafiken.findStop({ name: 'Kristianstad' }, function(results, err) {
// Do something with the results
});
Finds all starts and stops matching the query.
Options parameters
- from - query for start stop (string) - required
- to - query for end stop (string) - required
nodeSkanetrafiken.findStartAndStop({ from: 'Kristianstad', to: 'Malmö' }, function(results, err) {
// Do something with the results
});
Finds all stops within a circle of a (if specified) radius.
Options parameters
- x - coordinate in RT90 system (int) - required
- y - coordinate in RT90 system (int) - required
- radius - radius in meters (int) - optional
nodeSkanetrafiken.findNearestStops({ x: 6167930, y: 1323215, radius: 500 }, function(results, err) {
// Do something with the results
});
Lists all arrivals/departures at a given stop with a set of extra parameters. Note that neither date nor time can be present alone - both are needed.
Options parameters
- stopID - id of the stop (int) - required
- date - date for departures/arrivals in yymmdd (string) - optional
- time - time for departures/arrivals in hhmm (string) - optional
- arrivals - listing departures or arrivals (bool) - optional
nodeSkanetrafiken.getDepartures({ stopID: 80000, date: '170823', time: '1630', arrivals: true }, function(results, err) {
// Do something with the results
});
Find the different means of transportation.
No options object needed for this function.
### Example request
nodeSkanetrafiken.getTrafficMeans(function(results, err) {
// So something with the results
});
Search for journeys between to points. Note that neither date nor time can be present alone - both are needed.
Options parameters
- next - next/previous set of journeys (string) - required
- from - object containing info of departure point name|id|type (obj) - required
- to - object containing info of arrival point name|id|type (obj) - required
- limit - number of journeys (int) - optional
- date - date for departures/arrivals in yymmdd (string) - optional
- time - time for departures/arrivals in hhmm (string) - optional
- transportMode - sum of trafficmeans IDs (int) - optional
var from = { name: 'Malmö C', id: 80000, type: 0 };
var to = { name: 'Landskrona', id: 82000, type: 0 };
nodeSkanetrafiken.getJourneys({ from: from, to: to, action: 'next' }, function(results, err) {
// Do something with the results
});
I can't get this one to work with Skånetrafiken's API, so any help is much appreciated!