Skip to content

Commit 4ef5b74

Browse files
committed
no problem to use a folder ending with .osm or .xml, fixes graphhopper#857
1 parent 1960b0f commit 4ef5b74

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

core/src/main/java/com/graphhopper/GraphHopper.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ protected DataReader initDataReader(DataReader reader) {
735735
}
736736

737737
/**
738-
* Opens existing graph.
738+
* Opens existing graph folder.
739739
*
740740
* @param graphHopperFolder is the folder containing graphhopper files. Can be a compressed file
741741
* too ala folder-content.ghz.
@@ -749,9 +749,7 @@ public boolean load(String graphHopperFolder) {
749749
throw new IllegalStateException("graph is already successfully loaded");
750750

751751
if (graphHopperFolder.endsWith("-gh")) {
752-
// do nothing
753-
} else if (graphHopperFolder.endsWith(".osm") || graphHopperFolder.endsWith(".xml")) {
754-
throw new IllegalArgumentException("GraphHopperLocation cannot be the OSM file. Instead you need to use importOrLoad");
752+
// do nothing
755753
} else if (!graphHopperFolder.contains(".")) {
756754
if (new File(graphHopperFolder + "-gh").exists())
757755
graphHopperFolder += "-gh";
@@ -1085,7 +1083,7 @@ private void checkIfPointsAreInBounds(List<GHPoint> points) {
10851083
}
10861084

10871085
private void checkNonChMaxWaypointDistance(List<GHPoint> points) {
1088-
if(nonChMaxWaypointDistance == Integer.MAX_VALUE){
1086+
if (nonChMaxWaypointDistance == Integer.MAX_VALUE) {
10891087
return;
10901088
}
10911089
GHPoint lastPoint = points.get(0);
@@ -1097,9 +1095,9 @@ private void checkNonChMaxWaypointDistance(List<GHPoint> points) {
10971095
dist = calc.calcDist(lastPoint.getLat(), lastPoint.getLon(), point.getLat(), point.getLon());
10981096
if (dist > nonChMaxWaypointDistance) {
10991097
Map<String, Object> detailMap = new HashMap<>(2);
1100-
detailMap.put("from", i-1);
1098+
detailMap.put("from", i - 1);
11011099
detailMap.put("to", i);
1102-
throw new PointDistanceExceededException("Point " + i + " is too far from Point "+(i-1)+": " + point, detailMap);
1100+
throw new PointDistanceExceededException("Point " + i + " is too far from Point " + (i - 1) + ": " + point, detailMap);
11031101
}
11041102
lastPoint = point;
11051103
}

0 commit comments

Comments
 (0)