use of com.conveyal.gtfs.GTFSFeed in project graphhopper by graphhopper.
the class GtfsStorage method close.
@Override
public void close() {
if (!isClosed) {
isClosed = true;
data.close();
for (GTFSFeed feed : gtfsFeeds.values()) {
feed.close();
}
}
}
use of com.conveyal.gtfs.GTFSFeed in project graphhopper by graphhopper.
the class RealtimeFeed method toTripWithStopTimes.
public static GtfsReader.TripWithStopTimes toTripWithStopTimes(GTFSFeed feed, Agency agency, GtfsRealtime.TripUpdate tripUpdate) {
logger.trace("{}", tripUpdate.getTrip());
final List<StopTime> stopTimes = new ArrayList<>();
Set<Integer> cancelledArrivals = new HashSet<>();
Set<Integer> cancelledDepartures = new HashSet<>();
Trip originalTrip = feed.trips.get(tripUpdate.getTrip().getTripId());
Trip trip = new Trip();
if (originalTrip != null) {
trip.trip_id = originalTrip.trip_id;
trip.route_id = originalTrip.route_id;
} else {
trip.trip_id = tripUpdate.getTrip().getTripId();
trip.route_id = tripUpdate.getTrip().getRouteId();
}
int delay = 0;
int time = -1;
List<GtfsRealtime.TripUpdate.StopTimeUpdate> stopTimeUpdateListWithSentinel = new ArrayList<>(tripUpdate.getStopTimeUpdateList());
Iterable<StopTime> interpolatedStopTimesForTrip;
try {
interpolatedStopTimesForTrip = feed.getInterpolatedStopTimesForTrip(tripUpdate.getTrip().getTripId());
} catch (GTFSFeed.FirstAndLastStopsDoNotHaveTimes firstAndLastStopsDoNotHaveTimes) {
throw new RuntimeException(firstAndLastStopsDoNotHaveTimes);
}
int stopSequenceCeiling = Math.max(stopTimeUpdateListWithSentinel.isEmpty() ? 0 : stopTimeUpdateListWithSentinel.get(stopTimeUpdateListWithSentinel.size() - 1).getStopSequence(), StreamSupport.stream(interpolatedStopTimesForTrip.spliterator(), false).mapToInt(stopTime -> stopTime.stop_sequence).max().orElse(0)) + 1;
stopTimeUpdateListWithSentinel.add(GtfsRealtime.TripUpdate.StopTimeUpdate.newBuilder().setStopSequence(stopSequenceCeiling).setScheduleRelationship(NO_DATA).build());
for (GtfsRealtime.TripUpdate.StopTimeUpdate stopTimeUpdate : stopTimeUpdateListWithSentinel) {
int nextStopSequence = stopTimes.isEmpty() ? 1 : stopTimes.get(stopTimes.size() - 1).stop_sequence + 1;
for (int i = nextStopSequence; i < stopTimeUpdate.getStopSequence(); i++) {
StopTime previousOriginalStopTime = feed.stop_times.get(new Fun.Tuple2(tripUpdate.getTrip().getTripId(), i));
if (previousOriginalStopTime == null) {
// This can and does happen. Stop sequence numbers can be left out.
continue;
}
StopTime updatedPreviousStopTime = previousOriginalStopTime.clone();
updatedPreviousStopTime.arrival_time = Math.max(previousOriginalStopTime.arrival_time + delay, time);
logger.trace("stop_sequence {} scheduled arrival {} updated arrival {}", i, previousOriginalStopTime.arrival_time, updatedPreviousStopTime.arrival_time);
time = updatedPreviousStopTime.arrival_time;
updatedPreviousStopTime.departure_time = Math.max(previousOriginalStopTime.departure_time + delay, time);
logger.trace("stop_sequence {} scheduled departure {} updated departure {}", i, previousOriginalStopTime.departure_time, updatedPreviousStopTime.departure_time);
time = updatedPreviousStopTime.departure_time;
stopTimes.add(updatedPreviousStopTime);
logger.trace("Number of stop times: {}", stopTimes.size());
}
final StopTime originalStopTime = feed.stop_times.get(new Fun.Tuple2(tripUpdate.getTrip().getTripId(), stopTimeUpdate.getStopSequence()));
if (originalStopTime != null) {
StopTime updatedStopTime = originalStopTime.clone();
if (stopTimeUpdate.getScheduleRelationship() == NO_DATA) {
delay = 0;
}
if (stopTimeUpdate.hasArrival()) {
delay = stopTimeUpdate.getArrival().getDelay();
}
updatedStopTime.arrival_time = Math.max(originalStopTime.arrival_time + delay, time);
logger.trace("stop_sequence {} scheduled arrival {} updated arrival {}", stopTimeUpdate.getStopSequence(), originalStopTime.arrival_time, updatedStopTime.arrival_time);
time = updatedStopTime.arrival_time;
if (stopTimeUpdate.hasDeparture()) {
delay = stopTimeUpdate.getDeparture().getDelay();
}
updatedStopTime.departure_time = Math.max(originalStopTime.departure_time + delay, time);
logger.trace("stop_sequence {} scheduled departure {} updated departure {}", stopTimeUpdate.getStopSequence(), originalStopTime.departure_time, updatedStopTime.departure_time);
time = updatedStopTime.departure_time;
stopTimes.add(updatedStopTime);
logger.trace("Number of stop times: {}", stopTimes.size());
if (stopTimeUpdate.getScheduleRelationship() == SKIPPED) {
cancelledArrivals.add(stopTimeUpdate.getStopSequence());
cancelledDepartures.add(stopTimeUpdate.getStopSequence());
}
} else if (stopTimeUpdate.getScheduleRelationship() == NO_DATA) {
} else if (tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED) {
final StopTime stopTime = new StopTime();
stopTime.stop_sequence = stopTimeUpdate.getStopSequence();
stopTime.stop_id = stopTimeUpdate.getStopId();
stopTime.trip_id = trip.trip_id;
final ZonedDateTime arrival_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(ZoneId.of(agency.agency_timezone));
stopTime.arrival_time = (int) Duration.between(arrival_time.truncatedTo(ChronoUnit.DAYS), arrival_time).getSeconds();
final ZonedDateTime departure_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(ZoneId.of(agency.agency_timezone));
stopTime.departure_time = (int) Duration.between(departure_time.truncatedTo(ChronoUnit.DAYS), departure_time).getSeconds();
stopTimes.add(stopTime);
logger.trace("Number of stop times: {}", stopTimes.size());
} else {
throw new RuntimeException();
}
}
logger.trace("Number of stop times: {}", stopTimes.size());
// Not valid on any day. Just a template.
BitSet validOnDay = new BitSet();
return new GtfsReader.TripWithStopTimes(trip, stopTimes, validOnDay, cancelledArrivals, cancelledDepartures);
}
use of com.conveyal.gtfs.GTFSFeed in project graphhopper by graphhopper.
the class RealtimeFeed method fromProtobuf.
public static RealtimeFeed fromProtobuf(Graph graph, GtfsStorage staticGtfs, PtFlagEncoder encoder, GtfsRealtime.FeedMessage feedMessage) {
String feedKey = "gtfs_0";
GTFSFeed feed = staticGtfs.getGtfsFeeds().get(feedKey);
// TODO: Require configuration of feed and agency this realtime feed is for.
// Realtime feeds are always specific to an agency.
Agency agency = feed.agency.values().iterator().next();
final IntHashSet blockedEdges = new IntHashSet();
final IntLongHashMap delaysForBoardEdges = new IntLongHashMap();
final IntLongHashMap delaysForAlightEdges = new IntLongHashMap();
final LinkedList<VirtualEdgeIteratorState> additionalEdges = new LinkedList<>();
final Graph overlayGraph = new Graph() {
int nNodes = 0;
int firstEdge = graph.getAllEdges().getMaxId() + 1;
final NodeAccess nodeAccess = new NodeAccess() {
IntIntHashMap additionalNodeFields = new IntIntHashMap();
@Override
public int getAdditionalNodeField(int nodeId) {
return 0;
}
@Override
public void setAdditionalNodeField(int nodeId, int additionalValue) {
additionalNodeFields.put(nodeId, additionalValue);
}
@Override
public boolean is3D() {
return false;
}
@Override
public int getDimension() {
return 0;
}
@Override
public void ensureNode(int nodeId) {
}
@Override
public void setNode(int nodeId, double lat, double lon) {
}
@Override
public void setNode(int nodeId, double lat, double lon, double ele) {
}
@Override
public double getLatitude(int nodeId) {
return 0;
}
@Override
public double getLat(int nodeId) {
return 0;
}
@Override
public double getLongitude(int nodeId) {
return 0;
}
@Override
public double getLon(int nodeId) {
return 0;
}
@Override
public double getElevation(int nodeId) {
return 0;
}
@Override
public double getEle(int nodeId) {
return 0;
}
};
@Override
public Graph getBaseGraph() {
return graph;
}
@Override
public int getNodes() {
return graph.getNodes() + nNodes;
}
@Override
public NodeAccess getNodeAccess() {
return nodeAccess;
}
@Override
public BBox getBounds() {
return null;
}
@Override
public EdgeIteratorState edge(int a, int b) {
return null;
}
@Override
public EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections) {
int edge = firstEdge++;
final VirtualEdgeIteratorState newEdge = new VirtualEdgeIteratorState(-1, edge, a, b, distance, 0, "", new PointList());
final VirtualEdgeIteratorState reverseNewEdge = new VirtualEdgeIteratorState(-1, edge, b, a, distance, 0, "", new PointList());
newEdge.setReverseEdge(reverseNewEdge);
reverseNewEdge.setReverseEdge(newEdge);
additionalEdges.push(newEdge);
return newEdge;
}
@Override
public EdgeIteratorState getEdgeIteratorState(int edgeId, int adjNode) {
return null;
}
@Override
public AllEdgesIterator getAllEdges() {
return null;
}
@Override
public EdgeExplorer createEdgeExplorer(EdgeFilter filter) {
return null;
}
@Override
public EdgeExplorer createEdgeExplorer() {
return graph.createEdgeExplorer();
}
@Override
public Graph copyTo(Graph g) {
return null;
}
@Override
public GraphExtension getExtension() {
throw new RuntimeException();
}
};
Map<Integer, String> routes = new HashMap<>();
Map<GtfsStorage.Validity, Integer> operatingDayPatterns = new HashMap<>(staticGtfs.getOperatingDayPatterns());
Map<Integer, byte[]> tripDescriptors = new HashMap<>();
Map<Integer, Integer> stopSequences = new HashMap<>();
Map<String, int[]> boardEdgesForTrip = new HashMap<>();
Map<String, int[]> alightEdgesForTrip = new HashMap<>();
Map<GtfsStorage.FeedIdWithTimezone, Integer> writableTimeZones = new HashMap<>();
GtfsStorageI gtfsStorage = new GtfsStorageI() {
@Override
public Map<String, Fare> getFares() {
return null;
}
@Override
public Map<GtfsStorage.Validity, Integer> getOperatingDayPatterns() {
return operatingDayPatterns;
}
@Override
public Map<GtfsStorage.FeedIdWithTimezone, Integer> getWritableTimeZones() {
return writableTimeZones;
}
@Override
public Map<Integer, byte[]> getTripDescriptors() {
return tripDescriptors;
}
@Override
public Map<Integer, Integer> getStopSequences() {
return stopSequences;
}
@Override
public Map<String, int[]> getBoardEdgesForTrip() {
return boardEdgesForTrip;
}
@Override
public Map<String, int[]> getAlightEdgesForTrip() {
return alightEdgesForTrip;
}
@Override
public Map<String, GTFSFeed> getGtfsFeeds() {
HashMap<String, GTFSFeed> stringGTFSFeedHashMap = new HashMap<>();
stringGTFSFeedHashMap.put(feedKey, feed);
return stringGTFSFeedHashMap;
}
@Override
public Map<String, Transfers> getTransfers() {
return staticGtfs.getTransfers();
}
@Override
public Map<String, Integer> getStationNodes() {
return staticGtfs.getStationNodes();
}
@Override
public Map<Integer, String> getRoutes() {
return routes;
}
};
final GtfsReader gtfsReader = new GtfsReader(feedKey, overlayGraph, gtfsStorage, encoder, null);
Instant timestamp = Instant.ofEpochSecond(feedMessage.getHeader().getTimestamp());
// FIXME
LocalDate dateToChange = timestamp.atZone(ZoneId.of(agency.agency_timezone)).toLocalDate();
BitSet validOnDay = new BitSet();
LocalDate startDate = feed.calculateStats().getStartDate();
validOnDay.set((int) DAYS.between(startDate, dateToChange));
feedMessage.getEntityList().stream().filter(GtfsRealtime.FeedEntity::hasTripUpdate).map(GtfsRealtime.FeedEntity::getTripUpdate).filter(tripUpdate -> tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.SCHEDULED).forEach(tripUpdate -> {
String key = GtfsStorage.tripKey(tripUpdate.getTrip().getTripId(), tripUpdate.getTrip().getStartTime());
final int[] boardEdges = staticGtfs.getBoardEdgesForTrip().get(key);
final int[] leaveEdges = staticGtfs.getAlightEdgesForTrip().get(key);
if (boardEdges == null || leaveEdges == null) {
logger.warn("Trip not found: {}", tripUpdate.getTrip());
return;
}
tripUpdate.getStopTimeUpdateList().stream().filter(stopTimeUpdate -> stopTimeUpdate.getScheduleRelationship() == SKIPPED).mapToInt(GtfsRealtime.TripUpdate.StopTimeUpdate::getStopSequence).forEach(skippedStopSequenceNumber -> {
blockedEdges.add(boardEdges[skippedStopSequenceNumber]);
blockedEdges.add(leaveEdges[skippedStopSequenceNumber]);
});
GtfsReader.TripWithStopTimes tripWithStopTimes = toTripWithStopTimes(feed, agency, tripUpdate);
tripWithStopTimes.stopTimes.forEach(stopTime -> {
if (stopTime.stop_sequence > leaveEdges.length - 1) {
logger.warn("Stop sequence number too high {} vs {}", stopTime.stop_sequence, leaveEdges.length);
return;
}
final StopTime originalStopTime = feed.stop_times.get(new Fun.Tuple2(tripUpdate.getTrip().getTripId(), stopTime.stop_sequence));
int arrivalDelay = stopTime.arrival_time - originalStopTime.arrival_time;
delaysForAlightEdges.put(leaveEdges[stopTime.stop_sequence], arrivalDelay * 1000);
int departureDelay = stopTime.departure_time - originalStopTime.departure_time;
if (departureDelay > 0) {
int boardEdge = boardEdges[stopTime.stop_sequence];
int departureNode = graph.getEdgeIteratorState(boardEdge, Integer.MIN_VALUE).getAdjNode();
int timeOffset = tripUpdate.getTrip().hasStartTime() ? LocalTime.parse(tripUpdate.getTrip().getStartTime()).toSecondOfDay() : 0;
int delayedBoardEdge = gtfsReader.addDelayedBoardEdge(ZoneId.of(agency.agency_timezone), tripUpdate.getTrip(), stopTime.stop_sequence, stopTime.departure_time + timeOffset, departureNode, validOnDay);
delaysForBoardEdges.put(delayedBoardEdge, departureDelay * 1000);
}
});
});
feedMessage.getEntityList().stream().filter(GtfsRealtime.FeedEntity::hasTripUpdate).map(GtfsRealtime.FeedEntity::getTripUpdate).filter(tripUpdate -> tripUpdate.getTrip().getScheduleRelationship() == GtfsRealtime.TripDescriptor.ScheduleRelationship.ADDED).forEach(tripUpdate -> {
Trip trip = new Trip();
trip.trip_id = tripUpdate.getTrip().getTripId();
trip.route_id = tripUpdate.getTrip().getRouteId();
final List<StopTime> stopTimes = tripUpdate.getStopTimeUpdateList().stream().map(stopTimeUpdate -> {
final StopTime stopTime = new StopTime();
stopTime.stop_sequence = stopTimeUpdate.getStopSequence();
stopTime.stop_id = stopTimeUpdate.getStopId();
stopTime.trip_id = trip.trip_id;
final ZonedDateTime arrival_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(ZoneId.of(agency.agency_timezone));
stopTime.arrival_time = (int) Duration.between(arrival_time.truncatedTo(ChronoUnit.DAYS), arrival_time).getSeconds();
final ZonedDateTime departure_time = Instant.ofEpochSecond(stopTimeUpdate.getArrival().getTime()).atZone(ZoneId.of(agency.agency_timezone));
stopTime.departure_time = (int) Duration.between(departure_time.truncatedTo(ChronoUnit.DAYS), departure_time).getSeconds();
return stopTime;
}).collect(Collectors.toList());
GtfsReader.TripWithStopTimes tripWithStopTimes = new GtfsReader.TripWithStopTimes(trip, stopTimes, validOnDay, Collections.emptySet(), Collections.emptySet());
gtfsReader.addTrip(ZoneId.of(agency.agency_timezone), 0, new ArrayList<>(), tripWithStopTimes, tripUpdate.getTrip());
});
gtfsReader.wireUpStops();
return new RealtimeFeed(staticGtfs, feed, agency, feedMessage, blockedEdges, delaysForBoardEdges, delaysForAlightEdges, additionalEdges, tripDescriptors, stopSequences, operatingDayPatterns);
}
use of com.conveyal.gtfs.GTFSFeed in project OpenTripPlanner by opentripplanner.
the class FakeGraph method addTransitBidirectional.
/**
* Add transit (in both directions) to a Columbus graph
*/
public static void addTransitBidirectional(Graph gg) throws Exception {
// using conveyal GTFS lib to build GTFS so a lot of code does not have to be rewritten later
// once we're using the conveyal GTFS lib for everything we ought to be able to do this
// without even writing out the GTFS to a file.
GTFSFeed feed = new GTFSFeed();
Agency a = createDummyAgency("agency", "Agency", "America/New_York");
feed.agency.put("agency", a);
Route r = new Route();
r.route_short_name = "1";
r.route_long_name = "High Street";
r.route_type = 3;
r.agency = a;
r.route_id = "route";
feed.routes.put(r.route_id, r);
Service s = createDummyService();
feed.services.put(s.service_id, s);
com.conveyal.gtfs.model.Stop s1 = new com.conveyal.gtfs.model.Stop();
s1.stop_id = s1.stop_name = "s1";
s1.stop_lat = 40.2182;
s1.stop_lon = -83.0889;
feed.stops.put(s1.stop_id, s1);
com.conveyal.gtfs.model.Stop s2 = new com.conveyal.gtfs.model.Stop();
s2.stop_id = s2.stop_name = "s2";
s2.stop_lat = 39.9621;
s2.stop_lon = -83.0007;
feed.stops.put(s2.stop_id, s2);
// make timetabled trips
for (int departure = 7 * 3600; departure < 20 * 3600; departure += FREQUENCY) {
Trip t = new Trip();
t.trip_id = "trip" + departure;
t.service = s;
t.route = r;
t.direction_id = 0;
feed.trips.put(t.trip_id, t);
StopTime st1 = new StopTime();
st1.trip_id = t.trip_id;
st1.arrival_time = departure;
st1.departure_time = departure;
st1.stop_id = s1.stop_id;
st1.stop_sequence = 1;
feed.stop_times.put(new Fun.Tuple2(st1.trip_id, st1.stop_sequence), st1);
StopTime st2 = new StopTime();
st2.trip_id = t.trip_id;
st2.arrival_time = departure + TRAVEL_TIME;
st2.departure_time = departure + TRAVEL_TIME;
st2.stop_sequence = 2;
st2.stop_id = s2.stop_id;
feed.stop_times.put(new Fun.Tuple2(st2.trip_id, st2.stop_sequence), st2);
// opposite direction
t = new Trip();
t.trip_id = "trip_back" + departure;
t.service = s;
t.route = r;
t.direction_id = 1;
feed.trips.put(t.trip_id, t);
st1 = new StopTime();
st1.trip_id = t.trip_id;
st1.arrival_time = departure;
st1.departure_time = departure;
st1.stop_id = s2.stop_id;
st1.stop_sequence = 1;
feed.stop_times.put(new Fun.Tuple2(st1.trip_id, st1.stop_sequence), st1);
st2 = new StopTime();
st2.trip_id = t.trip_id;
st2.arrival_time = departure + TRAVEL_TIME;
st2.departure_time = departure + TRAVEL_TIME;
st2.stop_sequence = 2;
st2.stop_id = s1.stop_id;
feed.stop_times.put(new Fun.Tuple2(st2.trip_id, st2.stop_sequence), st2);
}
File tempFile = File.createTempFile("gtfs", ".zip");
feed.toFile(tempFile.getAbsolutePath());
// phew. load it into the graph.
GtfsModule gtfs = new GtfsModule(Arrays.asList(new GtfsBundle(tempFile)));
gtfs.buildGraph(gg, new HashMap<>());
}
use of com.conveyal.gtfs.GTFSFeed in project OpenTripPlanner by opentripplanner.
the class FakeGraph method addPerpendicularRoutes.
public static void addPerpendicularRoutes(Graph graph) throws Exception {
GTFSFeed feed = new GTFSFeed();
Agency agencyA = createDummyAgency("agencyA", "Agency A", "America/New_York");
feed.agency.put("agencyA", agencyA);
Agency agencyB = createDummyAgency("agencyB", "Agency B", "America/New_York");
feed.agency.put("agencyB", agencyB);
Service s = createDummyService();
feed.services.put(s.service_id, s);
int stopIdX = 0;
int stopIdY = 0;
for (double lat = 39.9058; lat < 40.0281; lat += 0.005) {
stopIdX = 0;
for (double lon = -83.1341; lon < -82.8646; lon += 0.005) {
com.conveyal.gtfs.model.Stop stop = new com.conveyal.gtfs.model.Stop();
stop.stop_id = stop.stop_name = String.format("s-%d-%d", stopIdX, stopIdY);
stop.stop_lat = lat;
stop.stop_lon = lon;
feed.stops.put(stop.stop_id, stop);
stopIdX++;
}
stopIdY++;
}
for (int i = 0; i < stopIdY; i++) {
Route route = new Route();
route.route_short_name = "hr" + i;
route.route_long_name = i + "th Horizontal Street";
route.route_type = Route.BUS;
route.agency = agencyA;
route.route_id = "horizontalroute" + i;
feed.routes.put(route.route_id, route);
}
for (int i = 0; i < stopIdX; i++) {
Route route = new Route();
route.route_short_name = "vr" + i;
route.route_long_name = i + "th Vertical Street";
route.route_type = Route.TRAM;
route.agency = agencyB;
route.route_id = "verticalroute" + i;
feed.routes.put(route.route_id, route);
}
Map<String, Route> routes = feed.routes;
com.conveyal.gtfs.model.Stop stop;
for (Route route : routes.values()) {
int routeId = Integer.parseInt(route.route_short_name.substring(2));
int x, y;
boolean isHorizontal = route.route_short_name.startsWith("hr");
for (int departure = 7 * 3600; departure < 20 * 3600; departure += FREQUENCY) {
Trip t = new Trip();
t.trip_id = "trip:" + route.route_id + ":" + departure;
t.service = s;
t.route = route;
feed.trips.put(t.trip_id, t);
int departureTime = departure;
int nrOfStops = (isHorizontal ? stopIdX : stopIdY);
for (int stopSequenceNr = 0; stopSequenceNr < nrOfStops; stopSequenceNr++) {
x = (isHorizontal ? stopSequenceNr : routeId);
y = (isHorizontal ? routeId : stopSequenceNr);
stop = feed.stops.get(String.format("s-%d-%d", x, y));
StopTime st1 = new StopTime();
st1.trip_id = t.trip_id;
st1.arrival_time = departureTime;
st1.departure_time = departureTime;
st1.stop_id = stop.stop_id;
st1.stop_sequence = stopSequenceNr + 1;
feed.stop_times.put(new Fun.Tuple2(st1.trip_id, st1.stop_sequence), st1);
// connect last stop to first so graph is fully reachable
if (stopSequenceNr == 0) {
StopTime stopTime = new StopTime();
stopTime.trip_id = t.trip_id;
stopTime.arrival_time = departureTime + nrOfStops * 120 + 30 * 60;
stopTime.departure_time = departureTime + nrOfStops * 120 + 30 * 60;
stopTime.stop_id = stop.stop_id;
stopTime.stop_sequence = stopSequenceNr + 1 + nrOfStops;
feed.stop_times.put(new Fun.Tuple2(stopTime.trip_id, stopTime.stop_sequence), stopTime);
}
departureTime += 120;
}
}
}
File tempFile = File.createTempFile("gtfs", ".zip");
feed.toFile(tempFile.getAbsolutePath());
// phew. load it into the graph.
GtfsModule gtfs = new GtfsModule(Arrays.asList(new GtfsBundle(tempFile)));
gtfs.buildGraph(graph, new HashMap<>());
}
Aggregations