Skip to content

Commit

Permalink
Merge pull request #1727 from buma/improvingMapbuilder
Browse files Browse the repository at this point in the history
Fixes BusRouteStreetMatcher matching when trip geometry is generated
  • Loading branch information
abyrd committed Feb 3, 2015
2 parents 80a83f0 + 3f83a0b commit dd40daa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
for (TripPattern pattern : graph.index.patternsForRoute.get(route)) {
if (pattern.mode == TraverseMode.BUS) {
/* we can only match geometry to streets on bus routes */
log.info("Matching {}", pattern);
log.debug("Matching {}", pattern);
//If there are no shapes in GTFS pattern geometry is generated
//generated geometry is useless for street matching
//that is why pattern.geometry is null in that case
if (pattern.geometry == null) {
continue;
}
List<Edge> edges = matcher.match(pattern.geometry);
if (edges == null || edges.isEmpty()) {
log.warn("Could not match to street network: {}", pattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,11 @@ public void run(Graph graph) {
for (int i = 0; i < tripPattern.hopEdges.length; i++) {
tripPattern.hopEdges[i].setGeometry(geom[i]);
}
// Make a geometry for the whole TripPattern from all its constituent hops.
// This happens only if geometry is found in geometriesByTripPattern,
// because that means that geometry was created from shapes instead "as crow flies"
tripPattern.makeGeometry();
}
// Make a geometry for the whole TripPattern from all its constituent hops.
tripPattern.makeGeometry();
tripPattern.setServiceCodes(graph.serviceCodes); // TODO this could be more elegant
}

Expand Down

0 comments on commit dd40daa

Please sign in to comment.