This is an unofficial node module, giving you a few options to query Dresden's public transport system for current bus- and tramstop data.
Want something like this for another language, look no further π
npm install dvbjsimport * as dvb from "dvbjs";Requires Node.js 20+ (uses native fetch).
import * as dvb from "dvbjs";
const data = await dvb.findStop("zellesch");
console.dir({ data }, { depth: 7, maxArrayLength: 2 });{
data: [
{
city: "Dresden",
coords: [13.745859050200034, 51.0283698098441],
name: "Zellescher Weg",
id: "33000312",
type: "Stop",
},
// ...
];
}import * as dvb from "dvbjs";
const stopID = "33000037"; // Postplatz
const timeOffset = 5;
const numResults = 2;
const data = await dvb.monitor(stopID, timeOffset, numResults);
console.dir(data, { depth: 7, maxArrayLength: 2 });[
{
arrivalTime: 2020-08-28T17:47:00.000Z,
scheduledTime: 2020-08-28T17:47:00.000Z,
id: 'voe:11012: :R:j20',
line: '12',
direction: 'Striesen',
platform: { name: '3', type: 'Platform' },
arrivalTimeRelative: 5,
scheduledTimeRelative: 5,
delayTime: 0,
state: 'InTime',
mode: {
title: 'StraΓenbahn',
name: 'Tram',
iconUrl: 'https://www.dvb.de/assets/img/trans-icon/transport-tram.svg'
},
diva: { number: 11012, network: 'voe' }
},
// ...
]import * as dvb from "dvbjs";
const origin = "33000742"; // HelmholtzstraΓe
const destination = "33000037"; // Postplatz
const startTime = new Date();
const isArrivalTime = false;
const data = await dvb.route(origin, destination, startTime, isArrivalTime);
console.dir(data, { depth: 7, maxArrayLength: 2 });Search for a single stop in the network of the DVB.
Search for POI in the network of the DVB.
Lookup address and nearby stops by coordinate.
Search for nearby stops assigned to an address.
Monitor a single stop to see every bus or tram leaving after the specified time offset.
| Parameter | Type | Default | Description |
|---|---|---|---|
| stopID | string | ID of the stop | |
| offset | number | 0 | how many minutes in the future |
| amount | number | 0 | number of results (0 for all) |
| timeout | number | 15000 | the timeout of the request in ms |
Query the server for possible routes from one stop to another.
| Parameter | Type | Default | Description |
|---|---|---|---|
| originID | string | the id of the origin stop | |
| destinationID | string | the id of the destination stop | |
| time | Date | new Date() | starting at what time |
| isArrivalTime | boolean | true | is time the arrival time |
| timeout | number | 15000 | the timeout of the request in ms |
| via | string | the id of a stop the route must pass |
Get a list of available tram/bus lines for a stop.
Search for different kinds of POIs inside a given bounding box.
| Parameter | Type | Default | Description |
|---|---|---|---|
| swlng | number | longitude of the south-west coordinate | |
| swlat | number | latitude of the south-west coordinate | |
| nelng | number | longitude of the north-east coordinate | |
| nelat | number | latitude of the north-east coordinate | |
| pinTypes | PIN_TYPE[] | [PIN_TYPE.stop] | array of pin types to search for |
| timeout | number | 15000 | the timeout of the request in ms |
interface Monitor {
arrivalTime: Date;
scheduledTime: Date;
id: string;
line: string;
direction: string;
platform?: Platform;
arrivalTimeRelative: number;
scheduledTimeRelative: number;
delayTime: number;
state: string;
mode?: Mode;
diva?: Diva;
}interface Route {
origin?: Location;
destination?: Location;
trips: Trip[];
}interface Trip {
departure?: StopLocation;
arrival?: StopLocation;
duration: number;
interchanges: number;
nodes: Node[];
}interface Node {
stops: Stop[];
departure?: StopLocation;
arrival?: StopLocation;
mode?: Mode;
line: string;
direction: string;
diva?: Diva;
dlid?: string;
duration: number;
path: coord[];
}interface Stop extends Location {
type: string;
platform?: Platform;
arrival: Date;
departure: Date;
dhid: string;
}interface Point extends Location {
type: POI_TYPE;
}interface Address extends Point {
stops: Point[];
}interface Location {
id: string;
name: string;
city: string;
coords: coord;
}interface StopLocation extends Location {
platform?: Platform;
time: Date;
type: string;
}interface Line {
name: string;
mode?: Mode;
diva?: Diva;
directions: string[];
}interface Pin {
id: string;
type: PIN_TYPE;
name: string;
coords: coord;
platformNr?: string;
connections?: Connection[];
info?: string;
}interface Connection {
line: string;
mode?: Mode;
}interface Mode {
title: string;
name: string;
iconUrl?: string;
}interface Diva {
number: number;
network?: string;
}interface Platform {
name: string;
type: string;
}type coord = [number, number]; // [lng, lat] in WGS84enum POI_TYPE {
Address = "Address",
Coords = "Coords",
POI = "POI",
Stop = "Stop",
}enum PIN_TYPE {
stop = "stop",
platform = "platform",
poi = "poi",
rentabike = "rentabike",
ticketmachine = "ticketmachine",
carsharing = "carsharing",
parkandride = "parkandride",
unknown = "unknown",
}