-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify stop times shape_dist_traveled
must not exceed the trip shape's maximum distance
#380
Conversation
Added rule specifying that the `shape_dist_traveled` for a stop time must not exceed the total (maximum) distance for the shape of the given trip.
Clarified the shape for the related trip
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Minor update to create commit with non-private email address.
Thanks! Aside: I think the spec leaves open some interpretation here. What about trip patterns that only use part of a shape? I think some producers do this. i.e.
You could use BTW, this is NOT how Trillium has implemented. In our GTFS there is always one shape_id per trip pattern. |
@antrim I totally agree and also interpret your examples all as valid. They would remain valid with these changes as none of them exceed the total distance of the shape. |
@stevenmwhite Yes, you're right. Not sure my comment was totally relevant here. maximum |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Keep open. |
I'd like to call for a vote on this but I'm having an issue getting Google to recognize that I've signed the CLA. Had some other issues to deal with and haven't been able to sort that out. Can I open a vote before that's done and sort it out after? |
This smells more like a validator rule than a highly specific reference change to me. This has been proposed as a rule in the validator: This is a good opportunity to create more clarity about the relationship between the Spec, Best Practices, and the validator. This is the existing language in the Spec, which already defines the correspondence between
|
The one thing the spec is missing as it describes these values (although I think it can/should be reasonably assumed) is that a trip cannot travel farther than its corresponding shape. I originally noted this as an issue with the validator, and @emmambd mentioned that the rule isn't in the validator because it's not in the spec (Also see this comment from @isabelle-dr MobilityData/gtfs-validator#163 (comment)) Thus, my hope is to clarify the spec and make this explicit -- with the ultimate goal of ensuring the canonical validator validates against it. |
Thanks for moving this discussion forward, @stevenmwhite and @antrim! At MobilityData, we plan to share some analytics to find examples of other feeds from the Mobility Database that aren't adhering to this rule to see if there are any valid cases / common occurrences. We expect to share our findings here next week. @stevenmwhite Re: CLA, based on the governance,, you can proceed with a vote before you sign the CLA. You'll just need to sign it before the PR can be accepted and merged. Let us know if you need any help with the CLA issues. |
Thanks @emmambd — I'll hold off on the vote until you have an opportunity to review any other feeds in the database. Let us know what you find. |
At MobilityData, we did a review of feeds in the Mobility Database where the In 49 feeds, there was 1% or less difference between max |
Alright, I've finally returned from some leave of various types and I'm ready to call for a vote on this one. I went through the feeds that @emmambd posted above and generally believe these to be software bugs. Two of the feeds were produced by our software and I've identified the issue that caused it. Otherwise, there's no logical way for a consumer to interpret a stop time distance that is beyond the distance of the shape. As this isn't a new feature, I don't exactly believe it requires a consumer and producer to implement anything -- it's just a clarification of the spec language. So, if the vote starts today, it will end at 23:59:59 UTC on July 27. |
+1 (OpenGeo, as producer) |
+1 Mecatran (producer & consumer) |
+1 |
+1 Transit |
+1 enRoute |
The vote has passed with none voting against and 5 voting in favor. |
Thanks to @stevenmwhite for being the PR advocate on this and to everyone who contributed to the discussion and voted! You can track MobilityData's work on adding this to the Canonical Validator at MobilityData/gtfs-validator#163. |
…pe's maximum distance (google#380) * Indicate max `shape_dist_traveled` for stop times Added rule specifying that the `shape_dist_traveled` for a stop time must not exceed the total (maximum) distance for the shape of the given trip. * Added trip reference Clarified the shape for the related trip * Minor update for Google CLA Minor update to create commit with non-private email address.
I had assumed this was reasonably implied but realized it wasn't explicit when I was recently debugging a GTFS feed. In the feed in question, the stop times
shape_dist_traveled
went from 0 to roughly 5.5 while the shape's distance went from 0 to 3.7.This was a standard one-way pattern -- not a loop -- and there was no reasonable explanation for this (except possibly that they used different units, which is not acceptable), yet the canonical validator did not throw an error. I subsequently used the older Google validator and did get a warning -- both for the distance exceeding the shape's maximum and for a resulting side-effect of the stop being too far from the shape based on that distance.
It seems to me that there's no reason the stop time's distance can ever legitimately exceed the shape's distance, but a few things I've heard or discussed with others as possibilities include:
shape_dist_traveled
then helps indicate which portion of the path (the first time the bus goes down that street or the second) the stop time is connected to.shape_dist_traveled
cannot go from the maximum back to zero, and there is no indication in the spec or best practices that by exceeding the maximum of the shape the intent is that the bus continues along the shape again from the start. (This would be similar to the way we can pass midnight by using times in excess of 24 hours... but I don't believe this is acceptable or intended from the spec for shape distances.)shape_dist_traveled
in stop times could be greater than that of the shape, if it uses a more realistic street-traveled distance, but I don't think this makes for a valid GTFS file. This field is used to tell consumers where the stop (which is not on the line) connects to the line, and if the stop times use an accurate street-traveled distance while the shape does not, the data in this field will be a big unmatched mess and the values won't match up in the way they are supposed to.I can't think of any other reason a stop time's distance can or should exceed the distance for the shape. Does anyone else have an example where this is expected or acceptable? I believe the intent of the spec is that it should not, and this PR clarifies that explicitly.