Skip to content

Commit

Permalink
Additional transfer time (#665)
Browse files Browse the repository at this point in the history
* Set additional transfer time

* Add documentation for footpath duration
  • Loading branch information
MichaelKutzner authored Nov 19, 2024
1 parent 0b0992d commit 59f430c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pkg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[nigiri]
[email protected]:motis-project/nigiri.git
branch=master
commit=542e9598870b299b1e5b293f1df025c0be016ad3
commit=6bf2a945bae16f3a5c420701f22b2971929c588e
[cista]
[email protected]:felixguendling/cista.git
branch=master
Expand Down
4 changes: 2 additions & 2 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
10390776021171648335
14822555216836180477
cista 847b27100b7e730370b810ce62206a66b0bf2d79
zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3
boost 930f38eb0365ceb7853273e03da4d9e7787abfb9
Expand All @@ -24,7 +24,7 @@ opentelemetry-cpp 60770dc9dc63e3543fc87d605b2e88fd53d7a414
pugixml 60175e80e2f5e97e027ac78f7e14c5acc009ce50
unordered_dense b33b037377ca966bbdd9cccc3417e46e88f83bfb
wyhash 1e012b57fc2227a9e583a57e2eacb3da99816d99
nigiri 542e9598870b299b1e5b293f1df025c0be016ad3
nigiri 6bf2a945bae16f3a5c420701f22b2971929c588e
conf f9bf4bd83bf55a2170725707e526cbacc45dcc66
expat 636c9861e8e7c119f3626d1e6c260603ab624516
libosmium 6e6d6b3081cc8bdf25dda89730e25c36eb995516
Expand Down
25 changes: 24 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,17 @@ paths:
type: integer
default: 0

- name: additionalTransferTime
in: query
required: false
description: |
Optional. Default is 0 minutes.
Additional transfer time reserved for each transfer in minutes.
schema:
type: integer
default: 0

- name: transferTimeFactor
in: query
required: false
Expand Down Expand Up @@ -1292,7 +1303,19 @@ components:
to:
$ref: '#/components/schemas/Place'
duration:
description: Leg duration in seconds
description: |
Leg duration in seconds
If leg is footpath:
The footpath duration is derived from the default footpath
duration using the query parameters `transferTimeFactor` and
`additionalTransferTime` as follows:
`leg.duration = defaultDuration * transferTimeFactor + additionalTransferTime.`
In case the defaultDuration is needed, it can be calculated by
`defaultDuration = (leg.duration - additionalTransferTime) / transferTimeFactor`.
Note that the default values are `transferTimeFactor = 1` and
`additionalTransferTime = 0` in case they are not explicitly
provided in the query.
type: integer
startTime:
type: string
Expand Down
3 changes: 3 additions & 0 deletions src/endpoints/routing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,11 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const {
.transfer_time_settings_ =
n::routing::transfer_time_settings{
.default_ = (query.minTransferTime_ == 0 &&
query.additionalTransferTime_ == 0 &&
query.transferTimeFactor_ == 1.0),
.min_transfer_time_ = n::duration_t{query.minTransferTime_},
.additional_time_ =
n::duration_t{query.additionalTransferTime_},
.factor_ = static_cast<float>(query.transferTimeFactor_)},
.via_stops_ =
get_via_stops(*tt_, *tags_, query.via_, query.viaMinimumStay_),
Expand Down

0 comments on commit 59f430c

Please sign in to comment.