Skip to content

Update shapes.txt to be conditionally required and recommended otherwise - #660

Merged
skalexch merged 2 commits into
google:masterfrom
simovilab:fix/shapes-conditionally-required
Sep 16, 2026
Merged

skalexch merged 2 commits into
google:masterfrom
simovilab:fix/shapes-conditionally-required

Conversation

@fabianabarca

Copy link
Copy Markdown
Contributor

Update shapes.txt to be conditionally required based on trips.shape_id and the continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt.

Summary

Make shapes.txt conditionally required in the table in Dataset Files of the GTFS Schedule reference.

Describe the Problem

According to issue #643, the field trips. shape_id (a foreign ID referencing shapes.shape_id) is Conditionally Required, with the following condition:

Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt

When that condition is true, shapes.txt becomes required as well, because trips.shape_id cannot be valid without a corresponding shapes.shape_id value.

Use Cases

It is relevant for consumers when planning the database schemas, and for evaluating correctness of the feed.

Proposed Solution

Originally:

File Name Presence Description
shapes.txt Optional Rules for mapping vehicle travel paths, sometimes referred to as route alignments.

Becomes:

File Name Presence Description
shapes.txt Conditionally Required Rules for mapping vehicle travel paths, sometimes referred to as route alignments.

Conditionally Required:
- Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt.
- Recommended otherwise.

This matches the existing condition on trips.shape_id and makes the transitive requirement explicit. Also, and following PR #470, shapes.txt should be recommended otherwise.

Type of change

GTFS Schedule

  • Functional Change
  • Non-Functional Change
  • Documentation Maintenance

GTFS Realtime

  • Specification Change
  • Specification Change (Experimental Field)

Checklist

…d and the continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt
@ghost

ghost commented Sep 9, 2026

Copy link
Copy Markdown

The presence conditions of files are also mentioned at the beginning of each file, it would need to be updated there as well :).

@fabianabarca

Copy link
Copy Markdown
Contributor Author

That's right! Thanks. I updated this:


shapes.txt

File: 👉 Conditionally Required 👈

Primary key (shape_id, shape_pt_sequence)

...


I noticed that the description of other files that are conditionally required don’t include the condition that makes them necessary because it is in the Dataset Files table, so I'm not adding anything else.

@etienne0101

Copy link
Copy Markdown
Collaborator

Thank you @fabianabarca for this pull request.
We will merge this as soon as it reaches the 7-day mark.

@skalexch
skalexch merged commit 3c9e7b9 into google:master Sep 16, 2026
6 checks passed
@skalexch skalexch added Change type: Documentation Maintenance Improvements to clarity, accuracy, and presentation without altering semantics or functionality. Ready to Merge The change has been approved and is ready to merge. labels Sep 16, 2026
@fabianabarca
fabianabarca deleted the fix/shapes-conditionally-required branch September 16, 2026 19:56
sneg55 added a commit to veodyn/gtfs-validator that referenced this pull request Sep 29, 2026
google/transit#660 makes shapes.txt conditionally required when a trip has
continuous pickup or drop-off, and recommended otherwise. google/transit#658
only rewords the BCP 47 link. Parity is with the pinned jar, so both are
facts about the future, not work: nothing under src/ moves until a release
carries them.
ttezer added a commit to ttezer/gtfs-analyzer that referenced this pull request Sep 30, 2026
spec_drift.py flagged a new upstream commit (#193). Regenerating the
provision catalogue from the live page gives the same 300 candidates and
the same provisions_sha256, so only the source metadata moves.

The one Schedule change in the range, shapes.txt becoming Conditionally
Required (google/transit#660), is already covered: TRP_019 (Spec) enforces
the continuous-service requirement and ARC_020 (Quality) the
recommendation. spec_fields.json already records it; gtfs.org still
renders shapes.txt as Optional, so that file was not regenerated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Change type: Documentation Maintenance Improvements to clarity, accuracy, and presentation without altering semantics or functionality. Ready to Merge The change has been approved and is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants