Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Island pruning #3426

Merged
merged 27 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aaabde1
feat: more accurate island pruning with traverse mode specific connec…
vesameskanen Sep 8, 2021
f8e5115
fix: formatting
vesameskanen Sep 9, 2021
1818826
fix: do not pollute issueStore by listing every island (they are too …
vesameskanen Sep 9, 2021
a9a529a
chore: improve detailed logging about islands
vesameskanen Sep 10, 2021
867b5e5
fix: do not log irrelevant stop count (always zero)
vesameskanen Sep 13, 2021
2e7b763
feat: use lookup table for nothru colors
vesameskanen Sep 14, 2021
7101a35
fix: move island pruning after stop linking
vesameskanen Sep 14, 2021
f6c425a
chore: tune logging and remove transit unlinking which crashes OTP
vesameskanen Sep 14, 2021
1ca6eac
chore: more logging about islands with stops
vesameskanen Sep 15, 2021
97685ea
fix: do the cleanup in correct way
vesameskanen Sep 22, 2021
f6dcc5e
fix: keep spatial index valid, and relink disconnected stops
vesameskanen Sep 23, 2021
a7092e3
Merge remote-tracking branch 'otp/dev-2.x' into island-pruning
vesameskanen Sep 23, 2021
6cfec29
feat: report graph island related connectivity problems in detail
vesameskanen Sep 23, 2021
79c39f9
chore: restore some cleanup actions
vesameskanen Sep 27, 2021
03b8392
Merge remote-tracking branch 'otp/dev-2.x' into island-pruning
vesameskanen Oct 5, 2021
017042b
fix: remove some more (old and new) tabs
vesameskanen Oct 5, 2021
c589238
cleanup: remove broken old pruning, and make new pruning non-optional…
vesameskanen Oct 6, 2021
ea66dd0
Update src/main/java/org/opentripplanner/graph_builder/module/PruneNo…
vesameskanen Oct 13, 2021
e16c319
Update src/main/java/org/opentripplanner/graph_builder/module/PruneNo…
vesameskanen Oct 13, 2021
11f1121
Update src/main/java/org/opentripplanner/graph_builder/module/PruneNo…
vesameskanen Oct 13, 2021
8704177
fix: use Color array for noThru color definitions
vesameskanen Oct 13, 2021
6a6f278
cleanup: remove outdated duplicate logging
vesameskanen Oct 20, 2021
fcc2216
Merge remote-tracking branch 'otp/dev-2.x' into island-pruning
vesameskanen Oct 20, 2021
6370c32
fix: some null logfile params were left in calls, removed
vesameskanen Oct 20, 2021
62bf562
fix: stop to street linker now logs the linked stop count. No need to…
vesameskanen Oct 20, 2021
e8205f9
Merge remote-tracking branch 'otp/dev-2.x' into island-pruning
vesameskanen Oct 20, 2021
844a867
docs: update changelog
vesameskanen Oct 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 0 additions & 215 deletions src/main/java/org/opentripplanner/common/StreetUtils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.opentripplanner.graph_builder.model.GtfsBundle;
import org.opentripplanner.graph_builder.module.DirectTransferGenerator;
import org.opentripplanner.graph_builder.module.GtfsModule;
import org.opentripplanner.graph_builder.module.PruneFloatingIslands;
import org.opentripplanner.graph_builder.module.PruneNoThruIslands;
import org.opentripplanner.graph_builder.module.StreetLinkerModule;
import org.opentripplanner.graph_builder.module.TransitToTaggedStopsModule;
import org.opentripplanner.graph_builder.module.map.BusRouteStreetMatcher;
Expand Down Expand Up @@ -125,10 +125,6 @@ public static GraphBuilder create(
osmModule.banDiscouragedBiking = config.banDiscouragedBiking;
osmModule.maxAreaNodes = config.maxAreaNodes;
graphBuilder.addModule(osmModule);
PruneFloatingIslands pruneFloatingIslands = new PruneFloatingIslands();
pruneFloatingIslands.setPruningThresholdIslandWithoutStops(config.pruningThresholdIslandWithoutStops);
pruneFloatingIslands.setPruningThresholdIslandWithStops(config.pruningThresholdIslandWithStops);
graphBuilder.addModule(pruneFloatingIslands);
}
if ( hasGtfs ) {
List<GtfsBundle> gtfsBundles = Lists.newArrayList();
Expand Down Expand Up @@ -172,6 +168,17 @@ public static GraphBuilder create(
StreetLinkerModule streetLinkerModule = new StreetLinkerModule();
streetLinkerModule.setAddExtraEdgesToAreas(config.areaVisibility);
graphBuilder.addModule(streetLinkerModule);

// Prune graph connectivity islands after transit stop linking, so that pruning can take into account
// existence of stops in islands. If an island has a stop, it actually may be a real island and should
// not be removed quite as easily
if ( hasOsm ) {
PruneNoThruIslands pruneNoThruIslands = new PruneNoThruIslands(streetLinkerModule);
pruneNoThruIslands.setPruningThresholdIslandWithoutStops(config.pruningThresholdIslandWithoutStops);
pruneNoThruIslands.setPruningThresholdIslandWithStops(config.pruningThresholdIslandWithStops);
graphBuilder.addModule(pruneNoThruIslands);
}

// Load elevation data and apply it to the streets.
// We want to do run this module after loading the OSM street network but before finding transfers.
List<ElevationGridCoverageFactory> elevationGridCoverageFactories = new ArrayList<>();
Expand Down Expand Up @@ -237,4 +244,3 @@ public static GraphBuilder create(
return graphBuilder;
}
}

Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.routing.core.TraverseMode;
import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.routing.graph.Vertex;

public class GraphConnectivity implements DataImportIssue {

public static final String FMT = "Removed/depedestrianized disconnected subgraph containing vertex '%s' at (%f, %f), with %d edges";
public static final String HTMLFMT = "Removed/depedestrianized disconnected subgraph containing vertex <a href='http://www.openstreetmap.org/node/%s'>'%s'</a>, with %d edges";

final Vertex vertex;
final int size;

public GraphConnectivity(Vertex vertex, int size){
this.vertex = vertex;
this.size = size;
public static final String FMT = "%s graph connectivity: found %d islands, %d islands with stops, modified %d islands with stops, removed %d isolated edges, removed traverse mode from %d edges, converted %d edges to no through traffic";

final TraverseMode traverseMode;
final long size;
final long stopIslands;
final long stopIslandsChanged;
final long removed;
final long restricted;
final long nothru;

public GraphConnectivity(TraverseMode traverseMode, long size, long stopIslands, long stopIslandsChanged, long removed, long restricted, long nothru) {
this.traverseMode = traverseMode;
this.size = size;
this.stopIslands = stopIslands;
this.stopIslandsChanged = stopIslandsChanged;
this.removed = removed;
this.restricted = restricted;
this.nothru = nothru;
}

@Override
public String getMessage() {
return String.format(FMT, vertex, vertex.getCoordinate().x, vertex.getCoordinate().y, size);
return String.format(FMT,this.traverseMode.toString(), this.size, this.stopIslands, this.stopIslandsChanged, this.removed, this.restricted, this.nothru);
}

@Override
public String getHTMLMessage() {
String label = vertex.getLabel();
if (label.startsWith("osm:")) {
String osmNodeId = label.split(":")[2];
return String.format(HTMLFMT, osmNodeId, osmNodeId, size);
} else {
return this.getMessage();
}
return this.getMessage();
}

@Override
public Vertex getReferencedVertex() {
return vertex;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.routing.graph.Vertex;

public class GraphIsland implements DataImportIssue {

public static final String FMT = "Processed disconnected subgraph containing vertex '%s' at (%f, %f), with %d edges";
public static final String HTMLFMT = "Processed disconnected subgraph containing vertex <a href='http://www.openstreetmap.org/node/%s'>'%s'</a>, with %d edges";

final Vertex vertex;
final int size;

public GraphIsland(Vertex vertex, int size){
this.vertex = vertex;
this.size = size;
}

@Override
public String getMessage() {
return String.format(FMT, vertex, vertex.getCoordinate().x, vertex.getCoordinate().y, size);
}

@Override
public String getHTMLMessage() {
String label = vertex.getLabel();
if (label.startsWith("osm:")) {
String osmNodeId = label.split(":")[2];
return String.format(HTMLFMT, osmNodeId, osmNodeId, size);
} else {
return this.getMessage();
}
}

@Override
public Vertex getReferencedVertex() {
return vertex;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.opentripplanner.graph_builder.issues;

import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.routing.graph.Vertex;

public class IsolatedStop implements DataImportIssue {

public static final String FMT = "Unable to link stop %s to the street graph";

final Vertex vertex;

public IsolatedStop(Vertex vertex){
this.vertex = vertex;
}

@Override
public String getMessage() {
return String.format(FMT, vertex.getLabel());
}

@Override
public String getHTMLMessage() {
return String.format(FMT, vertex.getLabel());
}

@Override
public Vertex getReferencedVertex() {
return vertex;
}
}
Loading