|
1 | 1 | package com.conveyal.gtfs.validator;
|
2 | 2 |
|
3 | 3 | import com.conveyal.gtfs.error.NewGTFSError;
|
| 4 | +import com.conveyal.gtfs.error.NewGTFSErrorType; |
4 | 5 | import com.conveyal.gtfs.error.SQLErrorStorage;
|
5 | 6 | import com.conveyal.gtfs.loader.Feed;
|
6 | 7 | import com.conveyal.gtfs.model.Entity;
|
@@ -47,14 +48,20 @@ public void validateTrip(Trip trip, Route route, List<StopTime> stopTimes, List<
|
47 | 48 | double distanceMeters = 0;
|
48 | 49 | for (int i = beginIndex + 1; i < stopTimes.size(); i++) {
|
49 | 50 | StopTime currStopTime = stopTimes.get(i);
|
| 51 | + if (currStopTime.pickup_type == 1 && currStopTime.drop_off_type == 1 && currStopTime.timepoint == 0) { |
| 52 | + // stop_time allows neither pickup or drop off and is not a timepoint, so it serves no purpose. |
| 53 | + registerError(currStopTime, NewGTFSErrorType.STOP_TIME_UNUSED); |
| 54 | + } |
50 | 55 | Stop currStop = stops.get(i);
|
51 | 56 | // Distance is accumulated in case times are not provided for some StopTimes.
|
52 | 57 | distanceMeters += fastDistance(currStop.stop_lat, currStop.stop_lon, prevStop.stop_lat, prevStop.stop_lon);
|
53 | 58 | // Check that shape_dist_traveled is increasing.
|
54 | 59 | checkShapeDistTraveled(prevStopTime, currStopTime);
|
55 | 60 | if (missingBothTimes(currStopTime)) {
|
56 | 61 | // FixMissingTimes has already been called, so both arrival and departure time are missing.
|
57 |
| - // The spec allows this. Other than accumulating distance, skip this StopTime. |
| 62 | + // The spec allows this. Other than accumulating distance, skip this StopTime. If this stop_time serves |
| 63 | + // as a timepoint; however, this is considered an error. |
| 64 | + if (currStopTime.timepoint == 1) registerError(currStopTime, NewGTFSErrorType.TIMEPOINT_MISSING_TIMES); |
58 | 65 | continue;
|
59 | 66 | }
|
60 | 67 | if (currStopTime.departure_time < currStopTime.arrival_time) {
|
|
0 commit comments