gtfs-validator icon indicating copy to clipboard operation
gtfs-validator copied to clipboard

Best Practice: Shape_dist_travelled must be included if route passes over same stop or segment (loop, lollipop, inlining) (WARNING)

Open e-lo opened this issue 4 years ago • 4 comments

Shape_dist_travelled must be included if route passes over same stop or segment (loop, lollipop, inlining)

e-lo avatar Apr 29 '21 05:04 e-lo

I am not sure that this must be recommended.

shape_dist_travelled is a nice field to have on its own. If it is missing, then GTFS consumer can figure out how the vehicle moves based on the coordinates of the shape and the stops.

Please could you provide some rationale, context and samples?

aababilov avatar May 02 '21 10:05 aababilov

If it is missing, then GTFS consumer can figure out how the vehicle moves based on the coordinates of the shape and the stops

I agree, this field is not per-say needed to realize computation on a GTFS dataset. However, as defined in best practices for stop_times.txt and best practices for shapes.txt it seems that implementing this rule is reasonable and indicated if we want to stick to the specification.

stop_times.txt

Field Name Recommendation
shape_dist_traveled shape_dist_traveled must be provided for routes that have looping or inlining (the vehicle crosses or travels over the same portion of alignment in one trip). See the shapes.shape_dist_traveled recommendation.

shapes.txt

Field Name Recommendation
shape_dist_traveled Must be provided in both shapes.txt and stop_times.txt if an alignment includes looping or inlining (the vehicle crosses or travels over the same portion of alignment in one trip).An Inlining Route
If a vehicle retraces or crosses the route alignment at points in the course of a trip, shape_dist_traveled is important to clarify how portions of the points in shapes.txt line up correspond with records in stop_times.txt.

Please could you provide some rationale, context and samples?

Yes @e-lo that would facilitate discussions and development.

lionel-nj avatar May 04 '21 18:05 lionel-nj

I wasn't part of the original best-practice discussion as to why this is important. Perhaps @LeoFrachet or @antrim can provide background (or link to it?)

e-lo avatar May 04 '21 18:05 e-lo

Google Transit Partners help says "For complex shape and stop sequences, the GTFS specification provides a mechanism for explicitly defining how stops are matched to the trip shape. The shapes.txt file defines a shape_dist_traveled field, which can be used to specify the distance along the shape for each point of the shape."

Google Maps used to fail to draw the alignment correctly if it crossed over itself and shape_dist_traveled was not provided. I don't know if that's still the case or if other applications have that issue. https://groups.google.com/g/transit-developers/c/KH8Ug66A7fk/m/t7uelxsnFL4J

antrim avatar May 04 '21 19:05 antrim