+ "snapping them to the shape for that trip. However, we could not find an assignment for each stop time "
+ "where the distance traveled along the shape for each stop time was strictly increasing (aka a stop time "
+ "seemed to travel backwards). For more information on errors of this kind, see:\n"
+ " https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching");
TripEntryImpl trip = first.getTrip();
_log.error("error constructing stop-time distances along shape for trip="
+ trip.getId() + " shape=" + trip.getShapeId() + " firstStopTime="
+ first.getId() + " lastStopTime=" + last.getId());
StringBuilder b = new StringBuilder();
int index = 0;
b.append("# potential assignments:\n");
b.append("# stopLat stopLon stopId\n");
b.append("# locationOnShapeLat locationOnShapeLon distanceAlongShape distanceFromShape shapePointIndex\n");
b.append("# ...\n");
double prevMaxDistanceAlongShape = Double.NEGATIVE_INFINITY;
for (List<PointAndIndex> possible : possibleAssignments) {
StopTimeEntryImpl stopTime = stopTimes.get(index);
StopEntryImpl stop = stopTime.getStop();
b.append(stop.getStopLat());
b.append(' ');
b.append(stop.getStopLon());
b.append(' ');
b.append(index);
b.append(' ');
b.append(stop.getId());
b.append('\n');
double maxDistanceAlongShape = Double.NEGATIVE_INFINITY;
double minDistanceAlongShape = Double.POSITIVE_INFINITY;
for (PointAndIndex pindex : possible) {
b.append(" ");
b.append(projection.reverse(pindex.point));
b.append(' ');
b.append(_errorFormatter.format(pindex.distanceAlongShape));
b.append(' ');
b.append(_errorFormatter.format(pindex.distanceFromTarget));
b.append(' ');
b.append(pindex.index);
b.append("\n");
maxDistanceAlongShape = Math.max(maxDistanceAlongShape,
pindex.distanceAlongShape);
minDistanceAlongShape = Math.min(minDistanceAlongShape,
pindex.distanceAlongShape);
}
if (minDistanceAlongShape < prevMaxDistanceAlongShape) {
b.append(" ^ potential problem here ^\n");
}
prevMaxDistanceAlongShape = maxDistanceAlongShape;
index++;
}
_log.error(b.toString());
if (_shapeIdsWeHavePrinted.add(trip.getShapeId())) {
b = new StringBuilder();
index = 0;
for (int i = 0; i < shapePoints.getSize(); i++) {
b.append(shapePoints.getLatForIndex(i));
b.append(' ');