Skip to content

Commit 5531902

Browse files
committed
bug testing for GH
1 parent a1efac2 commit 5531902

File tree

4 files changed

+61
-13
lines changed

4 files changed

+61
-13
lines changed

graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/CHMatrixGeneration.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ private static GraphHopper createHopper(boolean memoryMapped) {
7979
return ret;
8080
}
8181

82-
public CHMatrixGeneration(String graphFolder) {
83-
this(graphFolder, false);
82+
public CHMatrixGeneration(String graphFolder, String vehicleType) {
83+
this(graphFolder, false,vehicleType);
8484
}
8585

86-
public CHMatrixGeneration(String graphFolder, boolean memoryMapped) {
86+
public CHMatrixGeneration(String graphFolder, boolean memoryMapped, String vehicleType) {
8787
this.graphFolder = graphFolder;
8888
this.hopper = createHopper(memoryMapped);
8989
hopper.setGraphHopperLocation(this.graphFolder);
90-
hopper.setEncodingManager(new EncodingManager(EncodingManager.CAR));
91-
flagEncoder = hopper.getEncodingManager().getEncoder(EncodingManager.CAR);
90+
// hopper.setEncodingManager(new EncodingManager(vehicleType));
9291
hopper.importOrLoad();
92+
flagEncoder = hopper.getEncodingManager().getEncoder(vehicleType);
9393
encodingManager = hopper.getEncodingManager();
9494

9595
String vehicle = flagEncoder.toString();

graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/ProfileMatrixPerformance.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@
33
import java.time.LocalDateTime;
44
import java.util.Arrays;
55

6+
import com.graphhopper.routing.util.EncodingManager;
67
import com.graphhopper.util.shapes.GHPoint;
7-
import com.opendoorlogistics.graphhopper.geocodes4profiling.USAGeocodes;
8+
import com.opendoorlogistics.graphhopper.geocodes4profiling.UKGeocodes;
89

910
public class ProfileMatrixPerformance {
1011
public static void main(String []args){
11-
// String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh";
12-
String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh";
12+
String graphFolder = "C:\\Data\\Graphhopper0.5\\great-britain-latest.osm-gh";
13+
// String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh";
1314
int n = 250;
1415

15-
//GHPoint [] pnts = UKGeocodes.createUKGeocodes();
16-
GHPoint [] pnts = USAGeocodes.createUSAGeocodes();
16+
GHPoint [] pnts = UKGeocodes.createUKGeocodes();
17+
// GHPoint [] pnts = USAGeocodes.createUSAGeocodes();
1718

1819
pnts = Arrays.copyOf(pnts, Math.min(n, pnts.length));
1920

2021
// just take the problem points
21-
pnts = new GHPoint[]{pnts[1],pnts[168]};
22+
// pnts = new GHPoint[]{pnts[1],pnts[168]};
2223

2324

2425
System.out.println(LocalDateTime.now() + " - loading matrix from:" + graphFolder);
25-
CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false);
26+
CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false, "bike");
2627
System.out.println(LocalDateTime.now() + " - starting matrix profiling for " + pnts.length + " points");
2728
MatrixResult result1 = ch.calculateMatrix(pnts,null);
2829
System.out.println(result1);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#################
2+
### OSMReader ###
3+
4+
# No more than 3 encoders are allowed at once without changing another Graphhopper storage option...
5+
graph.flagEncoders=car,foot,bike
6+
7+
8+
# graph.dataaccess=MMAP_STORE_SYNC
9+
graph.dataaccess=RAM_STORE
10+
11+
# use contraction hierarchies to speed things up. requires more RAM/disc space for holding the graph
12+
# uncomment this if you need more control of you algorithm. then use graphhopper.chShortcuts(false, false)
13+
prepare.chShortcuts=fastest
14+
15+
# advanced options:
16+
# prepare.updates.periodic=3
17+
# prepare.updates.lazy=10
18+
# prepare.updates.neighbor=20
19+
prepare.minOnewayNetworkSize=200
20+
21+
# increase from 1 to 5, to reduce way geometry e.g. for android
22+
osmreader.wayPointMaxDistance=1
23+
24+
# possible options: car,foot,bike,mtb,racingbike (comma separated)
25+
# when using two or three option together remeber to set "prepare.chShortcuts=no" above.
26+
# There is also a new option bike2 which takes elevation data into account (like up-hill is slower than down-hill)
27+
# and requires enabling graph.elevation.provider below, see #169
28+
osmreader.acceptWay=car
29+
30+
# if you want to reduce storage size and you don't need instructions for a path uncomment this
31+
osmreader.instructions=false
32+
33+
# To populate your graph with elevation data use SRTM, default is noop
34+
# graph.elevation.provider=srtm
35+
# default location for cache is used /tmp/srtm
36+
# graph.elevation.cachedir=./srtmprovider/
37+
# If you have a slow disk or plenty of RAM change the default MMAP to
38+
# graph.elevation.dataaccess=RAM_STORE
39+
40+
# Location index lookup. Advanced customization. Resolution is in meter, the search specifies the 'radius' in number of tiles.
41+
# E.g. decrease resolution for a faster lookup and increase region search for a more dynamic search and less 'location not found' results
42+
# index.highResolution=300
43+
# index.maxRegionSearch=4
44+
45+
# if you want to support jsonp response type you need to add it explicitely here:
46+
#web.jsonpAllowed=true

graphhopper-odl-integration/src/test/java/com/opendoorlogistics/graphhopper/TestMatrixCalculation.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.junit.Before;
1212
import org.junit.Test;
1313

14+
import com.graphhopper.routing.util.EncodingManager;
1415
import com.graphhopper.util.shapes.GHPoint;
1516
import com.opendoorlogistics.graphhopper.CHMatrixGeneration;
1617
import com.opendoorlogistics.graphhopper.MatrixResult;
@@ -26,7 +27,7 @@ public class TestMatrixCalculation {
2627
public void setUp() throws Exception {
2728

2829
String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh";
29-
dijsktra = new CHMatrixGeneration(graphFolder);
30+
dijsktra = new CHMatrixGeneration(graphFolder, EncodingManager.CAR);
3031

3132
int n = 25;
3233
GHPoint[] pnts = UKGeocodes.createUKGeocodes();

0 commit comments

Comments
 (0)