Skip to content

Commit

Permalink
include zero distances as we'll remove them in cleanup stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Jun 27, 2012
1 parent 897c392 commit 05bf6ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Download OSM file (40MB compressed, then 450MB uncompressed), build graph hopper

> cd core; ./run.sh unterfranken
the resulting file will be around 30MB (still ways to improve it)

If you want to import a bigger OSM (Germany) then run:

* when executing the command again the OSM won't be parsed again, so the UI should pop up within 1 or 2 seconds.
Expand Down
6 changes: 3 additions & 3 deletions core/nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</goals>
<properties>
<exec.classpathScope>runtime</exec.classpathScope>
<exec.args>-Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.ui.MiniGraphUI debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<exec.args>-Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.reader.OSMReader debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
Expand All @@ -30,7 +30,7 @@
</goals>
<properties>
<exec.classpathScope>runtime</exec.classpathScope>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.ui.MiniGraphUI debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.reader.OSMReader debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<jpda.listen>true</jpda.listen>
<exec.executable>java</exec.executable>
</properties>
Expand All @@ -42,7 +42,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
</goals>
<properties>
<exec.args>${profiler.args} -Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.ui.MiniGraphUI debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<exec.args>${profiler.args} -Xms1000m -Xmx1000m -XX:PermSize=20m -XX:MaxPermSize=20m -classpath %classpath de.jetsli.graph.reader.OSMReader debug=true dijkstra=true graph=graph-unterfranken.osm osm=/media/SAMSUNG/unterfranken.osm /media/SAMSUNG/germany.osm</exec.args>
<profiler.action>profile</profiler.action>
<exec.executable>${profiler.java}</exec.executable>
</properties>
Expand Down
11 changes: 9 additions & 2 deletions core/src/main/java/de/jetsli/graph/reader/MMapGraphStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public boolean addNode(int osmId, double lat, double lon) {
return true;
}
int counter = 0;
int zeroCounter = 0;

@Override
public boolean addEdge(int nodeIdFrom, int nodeIdTo, boolean reverse, CalcDistance callback) {
Expand All @@ -86,8 +87,14 @@ public boolean addEdge(int nodeIdFrom, int nodeIdTo, boolean reverse, CalcDistan
double lot = g.getLongitude(toIndex);
double dist = callback.calcDistKm(laf, lof, lat, lot);
if (dist == 0) {
// dist = 0.001;
return false;
// As investigation shows often two paths should have crossed via one identical point
// but end up in two very close points. add here here and later this will be
// removed/fixed while removing short edges where one node is of degree 2
zeroCounter++;
if (zeroCounter % 10 == 0)
logger.info(zeroCounter + " zero distances, from:" + nodeIdFrom + " to:" + nodeIdTo
+ " (" + laf + ", " + lof + ")");
dist = 0.0001;
} else if (dist < 0) {
logger.info(counter + " - distances negative. " + fromIndex + " (" + laf + ", " + lof + ")->"
+ toIndex + "(" + lat + ", " + lot + ") :" + dist);
Expand Down

0 comments on commit 05bf6ab

Please sign in to comment.