Skip to content

[GTFS-Fares v2] Add duration limit to fare_leg_join_rules.txt#639

Open
skalexch wants to merge 3 commits into
google:masterfrom
MobilityData:add-duration-limit-to-leg-join-rules
Open

[GTFS-Fares v2] Add duration limit to fare_leg_join_rules.txt#639
skalexch wants to merge 3 commits into
google:masterfrom
MobilityData:add-duration-limit-to-leg-join-rules

Conversation

@skalexch
Copy link
Copy Markdown
Collaborator

@skalexch skalexch commented Jun 3, 2026

Summary

This proposal:

  • Adds duration_limit and duration_limit_type to join rules in fare_leg_join_rules.txt.
  • Suggests situations where it's possible to use either fare_leg_join_rules.txt or fare_transfer_rules.txt.
  • Forbids overlap between fare_leg_join_rules.txt and fare_transfer_rules.txt for joins based on network_id.

Describe the Problem

This was part of the distance-based fares proposal. We decided to separate it in its own proposal for a few reasons:

  1. The addition can actually help the fare implementation of many fare structures that are not distance-based (mentioned in Use Cases).
  2. The distance-based fares proposal is moving slower than is required by the need for adding duration parameters to fare_leg_join_rules.txt.

Use Cases

This is mainly to allow the usage of fare_leg_join_rules.txt as a simpler way to define transfers in fare structures such as:

Proposed Solution

Adding duration_limit and duration_limit_type to join rules in fare_leg_join_rules.txt and forbidding overlap between fare_leg_join_rules.txt and fare_transfer_rules.txt for joins based on network_id.

Type of change

GTFS Schedule

  • Functional Change
  • Non-Functional Change
  • Documentation Maintenance

GTFS Realtime

  • Specification Change
  • Specification Change (Experimental Field)

Additional Information

More research can be found in the research document.

Proposed Discussion Period

We propose a discussion period of at least 2 weeks before starting an official review period. We will start the review period later in June.

Testing Details

  • Consumer(s):
  • Producer(s):
  • Estimated Testing Period:

Proposal Update Tracker

Date Update Description
(2026-06-03) (Discussion period opened)

Checklist

@skalexch skalexch changed the title Add duration limit to leg join rules [GTFS-Fares v2] Add duration limit to fare_leg_join_rules.txt Jun 3, 2026
@skalexch skalexch added GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule GTFS-Fares Issues and Pull Requests that focus on GTFS-Fares Extension Discussion Period The community engages in conversations to help refine and develop the proposal. Change type: Functional Refers to modifications that significantly affect specification functionalities. labels Jun 3, 2026
@etienne0101
Copy link
Copy Markdown
Collaborator

Hi @BodoMinea @jfabi, @felixguendling, @jasonad123, @halbertram @skinkie @bdferris-v2 @miklcct @jll01 @davidlewis-ito

Following previous Fares Working Group discussions in 2025, we have decoupled the duration limit fields from the distance-based fares proposal into a standalone Pull Request.

We believe this addition is broadly useful for various fare structures beyond distance-based ones, especially for simplifying transfer definitions.

We are planning to initiate a "vote-to-test" in mid-July.
Please take a look at the PR and let us know if you have any feedback or if you are interested in testing these new fields.

Thank you in advance for your contribution!

Comment thread gtfs/spec/en/reference.md
| `from_stop_id` | Foreign ID referencing `stops.stop_id`| **Conditionally Required** | Matches a pre-transfer leg that ends at the specified stop (`location_type=0` or empty) or station (`location_type=1`).<br><br>Conditionally Required:<br> - **Required** if `to_stop_id` is defined.<br> - Optional otherwise. |
| `to_stop_id` | Foreign ID referencing `stops.stop_id`| **Conditionally Required** | Matches a post-transfer leg that starts at the specified stop (`location_type=0` or empty) or station (`location_type=1`).<br><br>Conditionally Required:<br> - **Required** if `from_stop_id` is defined.<br> - Optional otherwise. |
| `duration_limit` | Positive integer | **Optional** | Defines the duration limit of the transfer between the legs that constitute the effective leg. <br><br>Must be expressed in integer increments of seconds.<br><br>If there is no duration limit, `fare_leg_join_rules.duration_limit` must be empty. |
| `duration_limit_type` | Enum | **Conditionally Required** | Defines the relative start and end of `fare_leg_join_rules.duration_limit`.<br><br>Valid options are:<br>`0` - Between the departure fare validation of the first leg in the effective leg and the arrival fare validation of the last leg in the effective leg.<br>`1` - Between the departure fare validation of the first leg in the effective leg and the departure fare validation of the last leg in the effective leg.<br>`2` - Between the arrival fare validation of the first leg in the effective leg and the departure fare validation of the last leg in the effective leg.<br>`3` - Between the arrival fare validation of the first leg in the effective leg and the arrival fare validation of the last leg in the effective leg.<br><br>When an effective leg with the same `from_network_id` and `to_network_id` is matched multiple times consecutively within a multi-leg journey, the `duration_limit` specified by the effective leg should be measured starting from the first matched leg.<br><br>Conditionally Required:<br>- **Required** if `fare_leg_join_rules.duration_limit` is defined.<br>- **Forbidden** if `fare_leg_join_rules.duration_limit` is empty. |
Copy link
Copy Markdown

@felixguendling felixguendling Jun 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The router doesn't know when exactly the ticket will be validated (i.e. walking time between fare gate and departure/arrival of the vehicle vice versa).

So I would change departure fare validation to departure time (same for arrival).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Change type: Functional Refers to modifications that significantly affect specification functionalities. Discussion Period The community engages in conversations to help refine and develop the proposal. GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule GTFS-Fares Issues and Pull Requests that focus on GTFS-Fares Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants