use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoBike3D_twoSpeedsPerEdge.
@Test
public void testMonacoBike3D_twoSpeedsPerEdge() {
List<Query> queries = new ArrayList<>();
// 1. alternative: go over steps 'Rampe Major' => 1.7km vs. around 2.7km
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 2689, 118));
// 2.
queries.add(new Query(43.728499, 7.417907, 43.74958, 7.436566, 3735, 194));
// 3.
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2776, 167));
// 4.
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1544, 84));
// try reverse direction
// 1.
queries.add(new Query(43.727687, 7.418737, 43.730864, 7.420771, 2599, 115));
queries.add(new Query(43.74958, 7.436566, 43.728499, 7.417907, 4180, 165));
queries.add(new Query(43.739213, 7.427806, 43.728677, 7.41016, 3244, 179));
// 4. avoid tunnel(s)!
queries.add(new Query(43.739662, 7.424355, 43.733802, 7.413433, 2436, 112));
GraphHopper hopper = createHopper(MONACO, new Profile("bike2").setVehicle("bike2").setWeighting("fastest"));
hopper.setElevationProvider(new SRTMProvider(DIR));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testSimplePTurn.
@Test
public void testSimplePTurn() {
List<Query> list = new ArrayList<>();
list.add(new Query(0, 0.00099, -0.00099, 0, 664, 6));
GraphHopper hopper = createHopper(DIR + "/test_simple_pturn.osm.xml", new Profile("car").setVehicle("car").setWeighting("fastest").setTurnCosts(true));
hopper.importOrLoad();
checkQueries(hopper, list);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testBike2_issue432.
@Test
public void testBike2_issue432() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(52.349969, 8.013813, 52.349713, 8.013293, 56, 7));
// reverse route avoids the location
// list.add(new OneRun(52.349713, 8.013293, 52.349969, 8.013813, 293, 21));
GraphHopper hopper = createHopper(DIR + "/map-bug432.osm.gz", new Profile("bike2").setVehicle("bike2").setWeighting("fastest"));
hopper.setElevationProvider(new SRTMProvider(DIR));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class LMPreparationHandlerTest method testPrepareWeightingNo.
@Test
public void testPrepareWeightingNo() {
GraphHopperConfig ghConfig = new GraphHopperConfig();
ghConfig.setProfiles(Collections.singletonList(new Profile("profile")));
ghConfig.setLMProfiles(Collections.singletonList(new LMProfile("profile")));
LMPreparationHandler handler = new LMPreparationHandler();
handler.init(ghConfig);
assertTrue(handler.isEnabled());
// See #1076
ghConfig.setLMProfiles(Collections.emptyList());
handler = new LMPreparationHandler();
handler.init(ghConfig);
assertFalse(handler.isEnabled());
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class IsochroneExample method createGraphHopperInstance.
/**
* See {@link RoutingExample#createGraphHopperInstance} for more comments on creating the GraphHopper instance.
*/
static GraphHopper createGraphHopperInstance(String ghLoc) {
GraphHopper hopper = new GraphHopper();
hopper.setOSMFile(ghLoc);
hopper.setGraphHopperLocation("target/isochrone-graph-cache");
hopper.setProfiles(new Profile("car").setVehicle("car").setWeighting("fastest").setTurnCosts(false));
hopper.importOrLoad();
return hopper;
}
Aggregations