Skip to content

When feed contains critical errors all trips end up in one pattern #978

Description

@mattwigway

When a GTFS feed contains critical errors, we short-circuit in the loader and don't bother looking for patterns, since the feed shouldn't be usable for routing anyhow. However, loadFromGtfs assumes that patterns are created.

The code for creating TripPatterns from GTFS patterns starts out like this.

String patternId = gtfs.patternForTrip.get(tripId);

TripPattern tripPattern = tripPatternForPatternId.get(patternId);
if (tripPattern == null) {
       tripPattern = new TripPattern(String.format("%s:%s", gtfs.feedId, route.route_id), stopTimes, indexForUnscopedStopId);

If there are no patterns in the GTFS feed at all due to critical errors, gtfs.patternForTrip.get(tripId) will return null for all trips. null is allowed as a key in a Java HashMap, so the next few lines of code will create a trip pattern with the ID null and then add every last trip in the feed to that pattern. The first sign of any trouble won't show up until you do routing, when the overtakes function will report an array-out-of-bounds error because there are trips in the pattern that do not have the same number of stops.

I suspect in the Conveyal UI these critical feed errors are reported, but in other applications if using e.g. TransportNetwork.fromFiles the only sign that anything is wrong is that warning (not even an error) that the feed is unusable, and the network will build successfully.

First discovered by @c-voulgaris - @c-voulgaris is it ok to link to the GTFS you have that causes the issue here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions