MobilityData / gtfs-validator

Canonical GTFS Validator project for schedule (static) files.
https://gtfs-validator.mobilitydata.org/
Apache License 2.0
290 stars 101 forks source link

Flex: forbidden_shape_dist_traveled #1885

Closed emmambd closed 1 month ago

emmambd commented 1 month ago

Describe the problem

Based on this old feed and its associated validation report,, there are cases where a shape_dist_traveled value is included in stop_times.txt for a location or location group, where it doesn't make sense to draw a shape.

Describe the new validation rule

forbidden_shape_dist_traveled

Logic: If in stop_times.txt, there is a row with either location_id or location_group_id and shape_dist_traveled value, return an error.

Description: A GeoJSON location or location group has an associated shape_dist_traveled field in stop_times.txt. shape_dist_traveled values should only be provided for stops.

Columns:

tripId locationId locationGroupId csvRowNumber shapeDistTraveled

Sample GTFS datasets

https://data.trilliumtransit.com/gtfs/mountadams-wa-us/mountadams-wa-us.zip http://data.trilliumtransit.com/gtfs/thurston-wa-us/thurston-wa-us--flex-v2.zip

Severity

No response

Additional context

No response

jcpitre commented 1 month ago

Should the rule be expressed as we need a stop_id if we have a shape_dist_traveled field?

jcpitre commented 1 month ago

I found a problem: We get decreasing_or_equal_stop_time_distance notices based on the shape distance in records that have location_id and shape_dist_traveled. We need to exclude these records from the decreasing_or_equal_stop_time_distance validator.