diff --git a/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/CHMatrixGeneration.java b/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/CHMatrixGeneration.java index 0c8006b..c4d1cde 100644 --- a/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/CHMatrixGeneration.java +++ b/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/CHMatrixGeneration.java @@ -79,17 +79,17 @@ private static GraphHopper createHopper(boolean memoryMapped) { return ret; } - public CHMatrixGeneration(String graphFolder) { - this(graphFolder, false); + public CHMatrixGeneration(String graphFolder, String vehicleType) { + this(graphFolder, false,vehicleType); } - public CHMatrixGeneration(String graphFolder, boolean memoryMapped) { + public CHMatrixGeneration(String graphFolder, boolean memoryMapped, String vehicleType) { this.graphFolder = graphFolder; this.hopper = createHopper(memoryMapped); hopper.setGraphHopperLocation(this.graphFolder); - hopper.setEncodingManager(new EncodingManager(EncodingManager.CAR)); - flagEncoder = hopper.getEncodingManager().getEncoder(EncodingManager.CAR); + // hopper.setEncodingManager(new EncodingManager(vehicleType)); hopper.importOrLoad(); + flagEncoder = hopper.getEncodingManager().getEncoder(vehicleType); encodingManager = hopper.getEncodingManager(); String vehicle = flagEncoder.toString(); diff --git a/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/ProfileMatrixPerformance.java b/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/ProfileMatrixPerformance.java index 3abc6dd..a738264 100644 --- a/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/ProfileMatrixPerformance.java +++ b/graphhopper-odl-integration/src/main/java/com/opendoorlogistics/graphhopper/ProfileMatrixPerformance.java @@ -3,26 +3,27 @@ import java.time.LocalDateTime; import java.util.Arrays; +import com.graphhopper.routing.util.EncodingManager; import com.graphhopper.util.shapes.GHPoint; -import com.opendoorlogistics.graphhopper.geocodes4profiling.USAGeocodes; +import com.opendoorlogistics.graphhopper.geocodes4profiling.UKGeocodes; public class ProfileMatrixPerformance { public static void main(String []args){ - // String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh"; - String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh"; + String graphFolder = "C:\\Data\\Graphhopper0.5\\great-britain-latest.osm-gh"; + // String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh"; int n = 250; - //GHPoint [] pnts = UKGeocodes.createUKGeocodes(); - GHPoint [] pnts = USAGeocodes.createUSAGeocodes(); + GHPoint [] pnts = UKGeocodes.createUKGeocodes(); + // GHPoint [] pnts = USAGeocodes.createUSAGeocodes(); pnts = Arrays.copyOf(pnts, Math.min(n, pnts.length)); // just take the problem points - pnts = new GHPoint[]{pnts[1],pnts[168]}; + // pnts = new GHPoint[]{pnts[1],pnts[168]}; System.out.println(LocalDateTime.now() + " - loading matrix from:" + graphFolder); - CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false); + CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false, "bike"); System.out.println(LocalDateTime.now() + " - starting matrix profiling for " + pnts.length + " points"); MatrixResult result1 = ch.calculateMatrix(pnts,null); System.out.println(result1); diff --git a/graphhopper-odl-integration/src/main/resources/config-car-foot-bike.properties b/graphhopper-odl-integration/src/main/resources/config-car-foot-bike.properties new file mode 100644 index 0000000..72ba594 --- /dev/null +++ b/graphhopper-odl-integration/src/main/resources/config-car-foot-bike.properties @@ -0,0 +1,46 @@ +################# +### OSMReader ### + +# No more than 3 encoders are allowed at once without changing another Graphhopper storage option... +graph.flagEncoders=car,foot,bike + + +# graph.dataaccess=MMAP_STORE_SYNC +graph.dataaccess=RAM_STORE + +# use contraction hierarchies to speed things up. requires more RAM/disc space for holding the graph +# uncomment this if you need more control of you algorithm. then use graphhopper.chShortcuts(false, false) +prepare.chShortcuts=fastest + +# advanced options: +# prepare.updates.periodic=3 +# prepare.updates.lazy=10 +# prepare.updates.neighbor=20 +prepare.minOnewayNetworkSize=200 + +# increase from 1 to 5, to reduce way geometry e.g. for android +osmreader.wayPointMaxDistance=1 + +# possible options: car,foot,bike,mtb,racingbike (comma separated) +# when using two or three option together remeber to set "prepare.chShortcuts=no" above. +# There is also a new option bike2 which takes elevation data into account (like up-hill is slower than down-hill) +# and requires enabling graph.elevation.provider below, see #169 +osmreader.acceptWay=car + +# if you want to reduce storage size and you don't need instructions for a path uncomment this +osmreader.instructions=false + +# To populate your graph with elevation data use SRTM, default is noop +# graph.elevation.provider=srtm +# default location for cache is used /tmp/srtm +# graph.elevation.cachedir=./srtmprovider/ +# If you have a slow disk or plenty of RAM change the default MMAP to +# graph.elevation.dataaccess=RAM_STORE + +# Location index lookup. Advanced customization. Resolution is in meter, the search specifies the 'radius' in number of tiles. +# E.g. decrease resolution for a faster lookup and increase region search for a more dynamic search and less 'location not found' results +# index.highResolution=300 +# index.maxRegionSearch=4 + +# if you want to support jsonp response type you need to add it explicitely here: +#web.jsonpAllowed=true diff --git a/graphhopper-odl-integration/src/test/java/com/opendoorlogistics/graphhopper/TestMatrixCalculation.java b/graphhopper-odl-integration/src/test/java/com/opendoorlogistics/graphhopper/TestMatrixCalculation.java index 3bd837b..e7d4143 100644 --- a/graphhopper-odl-integration/src/test/java/com/opendoorlogistics/graphhopper/TestMatrixCalculation.java +++ b/graphhopper-odl-integration/src/test/java/com/opendoorlogistics/graphhopper/TestMatrixCalculation.java @@ -11,6 +11,7 @@ import org.junit.Before; import org.junit.Test; +import com.graphhopper.routing.util.EncodingManager; import com.graphhopper.util.shapes.GHPoint; import com.opendoorlogistics.graphhopper.CHMatrixGeneration; import com.opendoorlogistics.graphhopper.MatrixResult; @@ -26,7 +27,7 @@ public class TestMatrixCalculation { public void setUp() throws Exception { String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh"; - dijsktra = new CHMatrixGeneration(graphFolder); + dijsktra = new CHMatrixGeneration(graphFolder, EncodingManager.CAR); int n = 25; GHPoint[] pnts = UKGeocodes.createUKGeocodes();