Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

documentation to the PruneFloatingIslands process has been added #1000

Merged
merged 1 commit into from

2 participants

@novalis novalis merged commit 203b380 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 opentripplanner-graph-builder/samples/graph-config.xml
@@ -34,9 +34,9 @@
</bean>
<bean id="floatingIslands" class="org.opentripplanner.graph_builder.impl.PruneFloatingIslands">
- <property name="maxIslandSize" value="1000 "/>
+ <property name="islandWithoutStopsMaxSize" value="1000 "/>
<property name="islandLogFile" value="{graphPath}/island.csv"/>
- <property name="islandWithStopMaxSize" value="20"/>
+ <property name="islandWithStopsMaxSize" value="20"/>
<property name="transitToStreetNetwork" ref ="transitStreetLink"/>
</bean>
View
38 ...tripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/PruneFloatingIslands.java
@@ -13,32 +13,48 @@
package org.opentripplanner.graph_builder.impl;
-import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
-import lombok.Getter;
import lombok.Setter;
-import org.apache.log4j.*;
-import org.apache.log4j.Logger;
import org.opentripplanner.common.StreetUtils;
import org.opentripplanner.graph_builder.services.GraphBuilder;
import org.opentripplanner.routing.graph.Graph;
-import org.opentripplanner.routing.services.StreetVertexIndexService;
import org.slf4j.*;
+/**
+ * this module is part of the {@link GraphBuilder} process. it design to remove small isolated islands form the graph.
+ * Island created when there is no connectivity in the map, island acts like trap since there
+ * is no connectivity there is no way in or out the island.
+ * the module distinguish between two island types one with transit stops and without stops.
+ *
+ *
+ *
+ */
public class PruneFloatingIslands implements GraphBuilder {
private static org.slf4j.Logger _log = LoggerFactory.getLogger(PruneFloatingIslands.class);
+ /**
+ * this field indicate the maximum size for island without stops
+ * island under this size will be pruned.
+ */
@Setter
- private int maxIslandSize = 40;
+ private int islandWithoutStopsMaxSize = 40;
+ /**
+ * this field indicate the maximum size for island with stops
+ * island under this size will be pruned.
+ */
@Setter
- private int islandWithStopMaxSize = 5;
+ private int islandWithStopsMaxSize = 5;
+ /**
+ * The name for output file for this process, the file will store information about the islands were found and if they were pruned.
+ * If the value is an empty string there will be no output file.
+ */
@Setter
private String islandLogFile = "";
@@ -50,14 +66,18 @@
}
public List<String> getPrerequisites() {
-// return Arrays.asList("streets","linking");
+ /**this module can run after the street module only but if
+ * the street linker did not run then it couldn't identifies island with stops.
+ * so if the need is to distinguish between island with stops or without stops
+ * as explained before this module should run after the streets and the linker modules.
+ */
return Arrays.asList("streets");
}
@Override
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
_log.warn("Pruning isolated islands ...");
- StreetUtils.pruneFloatingIslands(graph, maxIslandSize, islandWithStopMaxSize,
+ StreetUtils.pruneFloatingIslands(graph, islandWithoutStopsMaxSize, islandWithStopsMaxSize,
LoggerAppenderProvider.createCsvFile4LoggerCat(islandLogFile, "islands"));
if(transitToStreetNetwork == null){
_log.warn("Could not reconnect stop, TransitToStreetNetworkGraphBuilder was not provided");
Something went wrong with that request. Please try again.