mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
journeys: add walkingSpeed option
This commit is contained in:
parent
33c1dc3c7e
commit
f8210c5515
1 changed files with 11 additions and 1 deletions
12
index.js
12
index.js
|
@ -144,6 +144,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
tickets: false, // return tickets?
|
tickets: false, // return tickets?
|
||||||
polylines: false, // return leg shapes?
|
polylines: false, // return leg shapes?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
|
walkingSpeed: 'normal', // 'slow', 'normal', 'fast'
|
||||||
// Consider walking to nearby stations at the beginning of a journey?
|
// Consider walking to nearby stations at the beginning of a journey?
|
||||||
startWithWalking: true,
|
startWithWalking: true,
|
||||||
scheduledDays: false
|
scheduledDays: false
|
||||||
|
@ -178,6 +179,15 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
filters.push(profile.filters.accessibility[opt.accessibility])
|
filters.push(profile.filters.accessibility[opt.accessibility])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!['slow','normal','fast'].includes(opt.walkingSpeed)) {
|
||||||
|
throw new Error('opt.walkingSpeed must be one of these values: "slow", "normal", "fast".')
|
||||||
|
}
|
||||||
|
const gisFltrL = [{
|
||||||
|
meta: 'foot_speed_' + opt.walkingSpeed,
|
||||||
|
mode: 'FB',
|
||||||
|
type: 'M'
|
||||||
|
}]
|
||||||
|
|
||||||
// With protocol version `1.16`, the VBB endpoint *used to* fail with
|
// With protocol version `1.16`, the VBB endpoint *used to* fail with
|
||||||
// `CGI_READ_FAILED` if you pass `numF`, the parameter for the number
|
// `CGI_READ_FAILED` if you pass `numF`, the parameter for the number
|
||||||
// of results. To circumvent this, we loop here, collecting journeys
|
// of results. To circumvent this, we loop here, collecting journeys
|
||||||
|
@ -197,12 +207,12 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
viaLocL: opt.via ? [{loc: opt.via}] : null,
|
viaLocL: opt.via ? [{loc: opt.via}] : null,
|
||||||
arrLocL: [to],
|
arrLocL: [to],
|
||||||
jnyFltrL: filters,
|
jnyFltrL: filters,
|
||||||
|
gisFltrL,
|
||||||
getTariff: !!opt.tickets,
|
getTariff: !!opt.tickets,
|
||||||
// todo: this is actually "take additional stations nearby the given start and destination station into account"
|
// todo: this is actually "take additional stations nearby the given start and destination station into account"
|
||||||
// see rest.exe docs
|
// see rest.exe docs
|
||||||
ushrp: !!opt.startWithWalking,
|
ushrp: !!opt.startWithWalking,
|
||||||
|
|
||||||
// todo: what is req.gisFltrL?
|
|
||||||
getPT: true, // todo: what is this?
|
getPT: true, // todo: what is this?
|
||||||
getIV: false, // todo: walk & bike as alternatives?
|
getIV: false, // todo: walk & bike as alternatives?
|
||||||
getPolyline: !!opt.polylines
|
getPolyline: !!opt.polylines
|
||||||
|
|
Loading…
Add table
Reference in a new issue