- Leonard Ehrenfried (firstname.lastname@example.org)
The code in this sandbox used to be part of OTP core but to allow more experimentation - in particular regarding GTFS Fares V2 - it was moved into a sandbox.
In 2022 the GTFS spec was extended to contain a powerful new model, called Fares V2, to describe fares, prices and products for public transport tickets. A baseline effort was merged into the main spec in May.
OTP experimentally supports the merged baseline plus a few extensions from the larger, unmerged spec.
To enable Fares V2 support, add the following to
Supported Fares V2 fields
A full list of the fields that OTP supports is available in the Fares V2 Adoption Google Sheet.
Custom fare calculators
When the GTFS Fares V1 spec was not enough, some organizations have developed their own calculators which are also part of the sandbox code.
The classes and their maintainers are as follows:
|HighestFareInFreeTransferWindowFareService||IBI Group (David Emory)|
|AtlantaFareService||IBI Group (David Emory)|
|CombinedInterlinedLegsFareService||IBI Group (David Emory)|
|HSLFareServiceImpl||HSL (Viljami Nurminen)|
|OrcaFareService||IBI Group (Daniel Heppner)|
By default OTP will compute fares according to the GTFS specification if fare data is provided in
your GTFS input. It is possible to turn off this by setting the fare to "off". For more complex
scenarios or to handle vehicle rental fares, it is necessary to manually configure fares using the
fares section in
build-config.json. You can combine different fares (for example transit and
vehicle-rental) by defining a
combinationStrategy parameter, and a list of sub-fares to combine
(all fields starting with
fare are considered to be sub-fares).
Or this alternative form that could allow additional configuration
Turning the fare service off, this will ignore any fare data in the provided GTFS data.
The current list of custom fare type is:
highest-fare-in-free-transfer-windowWill apply the highest observed transit fare (across all operators) within a free transfer window, adding to the cost if a trip is boarded outside the free transfer window. It accepts the following parameters:
freeTransferWindowthe duration (in ISO8601-ish notation) that free transfers are possible after the board time of the first transit leg. Default:
analyzeInterlinedTransfersIf true, will treat interlined transfers as actual transfers. This is merely a work-around for transit agencies that choose to code their fares in a route-based fashion instead of a zone-based fashion. Default:
combine-interlined-legsWill treat two interlined legs (those with a stay-seated transfer in between them) as a single leg for the purpose of fare calculation. It has a single parameter
modewhich controls when exactly the combination should happen:
ALWAYS: All interlined legs are combined. (default)
SAME_ROUTE: Only interlined legs whose route ID are identical are combined.
Removed fare calculators
The NYC fare calculator was removed in #4694.
MultipleFareService was removed in #5100.
TimeBasedVehicleRentalFareService were removed in #5145.
If you were using these calculators, you're welcome to re-add them to the code base and become their maintainer.