diff --git a/openapi.yaml b/openapi.yaml index 1287a1e0a..41da84daa 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -410,7 +410,7 @@ paths: - name: maxMatchingDistance in: query - required: true + required: false description: | Optional. Default is 25 meters. @@ -419,10 +419,25 @@ paths: type: number default: 25 - - name: wheelchair + - name: pedestrianProfile + in: query + required: false + description: | + Optional. Default is `FOOT`. + + Accessibility profile to use for pedestrian routing in transfers + between transit connections, on the first mile, and last mile. + schema: + $ref: '#/components/schemas/PedestrianProfile' + default: FOOT + + - name: useRoutedTransfers in: query - description: Whether the trip must be wheelchair accessible. required: false + description: | + Optional. Default is `false`. + + Whether to use transfers routed on OpenStreetMap data. schema: type: boolean default: false @@ -500,6 +515,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies to direct connections. A list of vehicle type form factors that are allowed to be used for direct connections. @@ -515,6 +532,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). A list of vehicle type form factors that are allowed to be used from the `from` coordinate to the first transit stop. @@ -530,6 +549,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). A list of vehicle type form factors that are allowed to be used from the last transit stop to the `to` coordinate. @@ -545,6 +566,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies to direct connections. A list of vehicle type form factors that are allowed to be used for direct connections. @@ -560,6 +583,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). A list of vehicle propulsion types that are allowed to be used from the `from` coordinate to the first transit stop. @@ -575,6 +600,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). A list of vehicle propulsion types that are allowed to be used from the last transit stop to the `to` coordinate. @@ -590,6 +617,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies to direct connections. A list of rental providers that are allowed to be used for direct connections. @@ -603,6 +632,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). A list of rental providers that are allowed to be used from the `from` coordinate to the first transit stop. @@ -616,6 +647,8 @@ paths: in: query required: false description: | + Experimental. Expect unannounced breaking changes (without version bumps). + Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). A list of rental providers that are allowed to be used from the last transit stop to the `to` coordinate. @@ -1070,13 +1103,20 @@ components: description: score according to the internal scoring system (the scoring algorithm might change in the future) type: number + PedestrianProfile: + description: Different accessibility profiles for pedestrians. + type: string + enum: + - FOOT + - WHEELCHAIR + Mode: description: | # Street modes - `WALK` - `BIKE` - - `RENTAL` + - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). - `CAR` - `CAR_PARKING` diff --git a/src/endpoints/routing.cc b/src/endpoints/routing.cc index 2fe9de7b3..a9b96b242 100644 --- a/src/endpoints/routing.cc +++ b/src/endpoints/routing.cc @@ -445,7 +445,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { ? route_direct(e, gbfs_rd, from_p, to_p, direct_modes, query.directRentalFormFactors_, query.directRentalPropulsionTypes_, - query.directRentalProviders_, *t, query.wheelchair_, + query.directRentalProviders_, *t, + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, std::chrono::seconds{query.maxDirectTime_}) : std::pair{std::vector{}, kInfinityDuration}; UTL_STOP_TIMING(direct); @@ -469,7 +471,8 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { return get_offsets( pos, dir, start_modes, start_form_factors, start_propulsion_types, start_rental_providers, - query.wheelchair_, + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, std::chrono::seconds{query.maxPreTransitTime_}, query.maxMatchingDistance_, gbfs_rd); }}, @@ -483,7 +486,8 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { return get_offsets( pos, dir, dest_modes, dest_form_factors, dest_propulsion_types, dest_rental_providers, - query.wheelchair_, + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, std::chrono::seconds{query.maxPostTransitTime_}, query.maxMatchingDistance_, gbfs_rd); }}, @@ -498,7 +502,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { ? osr::direction::kBackward : osr::direction::kForward; return get_td_offsets( - *e, pos, dir, start_modes, query.wheelchair_, + *e, pos, dir, start_modes, + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, std::chrono::seconds{query.maxPreTransitTime_}); }}, start) @@ -513,7 +519,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { ? osr::direction::kForward : osr::direction::kBackward; return get_td_offsets( - *e, pos, dir, dest_modes, query.wheelchair_, + *e, pos, dir, dest_modes, + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, std::chrono::seconds{ query.maxPostTransitTime_}); }}, @@ -530,7 +538,13 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { .min_connection_count_ = static_cast(query.numItineraries_), .extend_interval_earlier_ = start_time.extend_interval_earlier_, .extend_interval_later_ = start_time.extend_interval_later_, - .prf_idx_ = static_cast(query.wheelchair_ ? 2U : 1U), + .prf_idx_ = static_cast( + query.useRoutedTransfers_ + ? (query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR + ? 2U + : 1U) + : 0U), .allowed_claszes_ = to_clasz_mask(query.transitModes_), .require_bike_transport_ = query.requireBikeTransport_, .transfer_time_settings_ = @@ -585,7 +599,9 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { [&, cache = street_routing_cache_t{}](auto&& j) mutable { return journey_to_response( w_, l_, pl_, *tt_, *tags_, e, rtt, matches_, shapes_, gbfs_rd, - query.wheelchair_, j, start, dest, cache, *blocked); + query.pedestrianProfile_ == + api::PedestrianProfileEnum::WHEELCHAIR, + j, start, dest, cache, *blocked); }), .previousPageCursor_ = fmt::format("EARLIER|{}", to_seconds(r.interval_.from_)), diff --git a/test/routing_test.cc b/test/routing_test.cc index 5205b2719..a31828c32 100644 --- a/test/routing_test.cc +++ b/test/routing_test.cc @@ -396,6 +396,7 @@ TEST(motis, routing) { "&toPlace=50.11347,8.67664" "&time=2019-05-01T01:25Z" "&timetableView=false" + "&useRoutedTransfers=true" "&preTransitModes=WALK,RENTAL"); auto ss = std::stringstream{}; @@ -422,7 +423,8 @@ TEST(motis, routing) { "?fromPlace=49.87263,8.63127" "&toPlace=50.11347,8.67664" "&time=2019-05-01T01:25Z" - "&wheelchair=true" + "&pedestrianProfile=WHEELCHAIR" + "&useRoutedTransfers=true" "&timetableView=false"); auto ss = std::stringstream{}; @@ -447,6 +449,7 @@ TEST(motis, routing) { "?fromPlace=49.87263,8.63127" "&toPlace=50.11347,8.67664" "&time=2019-05-01T01:25Z" + "&useRoutedTransfers=true" "&timetableView=false"); auto ss = std::stringstream{}; diff --git a/ui/src/lib/openapi/schemas.gen.ts b/ui/src/lib/openapi/schemas.gen.ts index b408c572f..1a59a11de 100644 --- a/ui/src/lib/openapi/schemas.gen.ts +++ b/ui/src/lib/openapi/schemas.gen.ts @@ -113,12 +113,18 @@ export const MatchSchema = { } } as const; +export const PedestrianProfileSchema = { + description: 'Different accessibility profiles for pedestrians.', + type: 'string', + enum: ['FOOT', 'WHEELCHAIR'] +} as const; + export const ModeSchema = { description: `# Street modes - \`WALK\` - \`BIKE\` - - \`RENTAL\` + - \`RENTAL\` Experimental. Expect unannounced breaking changes (without version bumps). - \`CAR\` - \`CAR_PARKING\` diff --git a/ui/src/lib/openapi/types.gen.ts b/ui/src/lib/openapi/types.gen.ts index d70a4f537..9f297db4e 100644 --- a/ui/src/lib/openapi/types.gen.ts +++ b/ui/src/lib/openapi/types.gen.ts @@ -103,12 +103,17 @@ export type Match = { */ export type type = 'ADDRESS' | 'PLACE' | 'STOP'; +/** + * Different accessibility profiles for pedestrians. + */ +export type PedestrianProfile = 'FOOT' | 'WHEELCHAIR'; + /** * # Street modes * * - `WALK` * - `BIKE` - * - `RENTAL` + * - `RENTAL` Experimental. Expect unannounced breaking changes (without version bumps). * - `CAR` * - `CAR_PARKING` * @@ -720,6 +725,8 @@ export type PlanData = { */ directModes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies to direct connections. * * A list of vehicle type form factors that are allowed to be used for direct connections. @@ -729,6 +736,8 @@ export type PlanData = { */ directRentalFormFactors?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies to direct connections. * * A list of vehicle type form factors that are allowed to be used for direct connections. @@ -738,6 +747,8 @@ export type PlanData = { */ directRentalPropulsionTypes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies to direct connections. * * A list of rental providers that are allowed to be used for direct connections. @@ -755,27 +766,13 @@ export type PlanData = { * */ maxDirectTime?: number; - /** - * The maximum travel time in hours. - * If not provided, the routing to uses the value - * hardcoded in the server which is usually quite high. - * - * *Warning*: Use with care. Setting this too low can lead to - * optimal (e.g. the least transfers) journeys not being found. - * If this value is too low to reach the destination at all, - * it can lead to slow routing performance. - * - * TODO: pass parameter to nigiri - * - */ - maxHours?: number; /** * Optional. Default is 25 meters. * * Maximum matching distance in meters to match geo coordinates to the street network. * */ - maxMatchingDistance: number; + maxMatchingDistance?: number; /** * Optional. Default is 15min which is `900`. * Maximum time in seconds for the last street leg. @@ -800,6 +797,18 @@ export type PlanData = { * */ maxTransfers?: number; + /** + * The maximum travel time in minutes. + * If not provided, the routing to uses the value + * hardcoded in the server which is usually quite high. + * + * *Warning*: Use with care. Setting this too low can lead to + * optimal (e.g. the least transfers) journeys not being found. + * If this value is too low to reach the destination at all, + * it can lead to slow routing performance. + * + */ + maxTravelTime?: number; /** * Optional. Default is 0 minutes. * @@ -821,6 +830,14 @@ export type PlanData = { * */ pageCursor?: string; + /** + * Optional. Default is `FOOT`. + * + * Accessibility profile to use for pedestrian routing in transfers + * between transit connections, on the first mile, and last mile. + * + */ + pedestrianProfile?: PedestrianProfile; /** * Optional. Default is `WALK`. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directModes`). * @@ -829,6 +846,8 @@ export type PlanData = { */ postTransitModes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). * * A list of vehicle type form factors that are allowed to be used from the last transit stop to the `to` coordinate. @@ -838,6 +857,8 @@ export type PlanData = { */ postTransitRentalFormFactors?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). * * A list of vehicle propulsion types that are allowed to be used from the last transit stop to the `to` coordinate. @@ -847,6 +868,8 @@ export type PlanData = { */ postTransitRentalPropulsionTypes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `to` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). * * A list of rental providers that are allowed to be used from the last transit stop to the `to` coordinate. @@ -862,6 +885,8 @@ export type PlanData = { */ preTransitModes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalFormFactors`). * * A list of vehicle type form factors that are allowed to be used from the `from` coordinate to the first transit stop. @@ -871,6 +896,8 @@ export type PlanData = { */ preTransitRentalFormFactors?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalPropulsionTypes`). * * A list of vehicle propulsion types that are allowed to be used from the `from` coordinate to the first transit stop. @@ -880,6 +907,8 @@ export type PlanData = { */ preTransitRentalPropulsionTypes?: Array; /** + * Experimental. Expect unannounced breaking changes (without version bumps). + * * Optional. Only applies if the `from` place is a coordinate (not a transit stop). Does not apply to direct connections (see `directRentalProviders`). * * A list of rental providers that are allowed to be used from the `from` coordinate to the first transit stop. @@ -951,6 +980,13 @@ export type PlanData = { * */ transitModes?: Array; + /** + * Optional. Default is `false`. + * + * Whether to use transfers routed on OpenStreetMap data. + * + */ + useRoutedTransfers?: boolean; /** * List of via stops to visit (only stop IDs, no coordinates allowed for now). * Also see the optional parameter `viaMinimumStay` to set a set a minimum stay duration for each via stop. @@ -969,10 +1005,6 @@ export type PlanData = { * */ viaMinimumStay?: Array<(number)>; - /** - * Whether the trip must be wheelchair accessible. - */ - wheelchair?: boolean; }; }; diff --git a/ui/src/routes/+page.svelte b/ui/src/routes/+page.svelte index 12aadbb57..fccb1eb4d 100644 --- a/ui/src/routes/+page.svelte +++ b/ui/src/routes/+page.svelte @@ -111,7 +111,7 @@ toPlace: toPlaceString(to), arriveBy: timeType === 'arrival', timetableView: true, - wheelchair, + pedestrianProfile: wheelchair ? 'WHEELCHAIR' : 'FOOT', preTransitModes: modes, postTransitModes: modes, directModes: modes