use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonaco.
@Test
public void testMonaco() {
GraphHopper hopper = createHopper(MONACO, new Profile("car").setVehicle("car").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, createMonacoCarQueries());
Graph g = hopper.getGraphHopperStorage();
// When OSM file stays unchanged make static edge and node IDs a requirement
assertEquals(GHUtility.asSet(9, 111, 182), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(10)));
assertEquals(GHUtility.asSet(19, 21), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(20)));
assertEquals(GHUtility.asSet(478, 84, 83), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(480)));
assertEquals(43.736989, g.getNodeAccess().getLat(10), 1e-6);
assertEquals(7.429758, g.getNodeAccess().getLon(201), 1e-6);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoMotorcycleCurvature.
@Test
public void testMonacoMotorcycleCurvature() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(43.730729, 7.42135, 43.727697, 7.419199, 2681, 119));
queries.add(new Query(43.727687, 7.418737, 43.74958, 7.436566, 3727, 170));
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.4277, 3168, 169));
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 2423, 141));
queries.add(new Query(43.730949, 7.412338, 43.739643, 7.424542, 2253, 120));
queries.add(new Query(43.727592, 7.419333, 43.727712, 7.419333, 0, 1));
GraphHopper hopper = createHopper(MONACO, new Profile("motorcycle").setVehicle("motorcycle").setWeighting("curvature"));
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 testMonacoMixed.
@Test
public void testMonacoMixed() {
// Additional locations are inserted because of new crossings from foot to highway paths!
// Distance is the same.
List<Query> queries = createMonacoCarQueries();
queries.get(0).getPoints().get(1).expectedPoints = 110;
queries.get(1).getPoints().get(1).expectedPoints = 170;
queries.get(2).getPoints().get(1).expectedPoints = 132;
queries.get(3).getPoints().get(1).expectedPoints = 137;
queries.get(4).getPoints().get(1).expectedPoints = 116;
GraphHopper hopper = createHopper(MONACO, new Profile("car").setVehicle("car").setWeighting("shortest"), new Profile("foot").setVehicle("foot").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoVia.
@Test
public void testMonacoVia() {
Query query = new Query();
query.add(43.730729, 7.42135, 0, 0);
query.add(43.727697, 7.419199, 2581, 110);
query.add(43.726387, 7.405, 3001, 90);
List<Query> queries = new ArrayList<>();
queries.add(query);
GraphHopper hopper = createHopper(MONACO, new Profile("car").setVehicle("car").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoMountainBike.
@Test
public void testMonacoMountainBike() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 2593, 110));
queries.add(new Query(43.727687, 7.418737, 43.74958, 7.436566, 3655, 176));
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2331, 121));
// hard to select between secondary and primary (both are AVOID for mtb)
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1459, 88));
GraphHopper hopper = createHopper(MONACO, new Profile("mtb").setVehicle("mtb").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
Helper.removeDir(new File(GH_LOCATION));
hopper = createHopper(MONACO, new Profile("mtb").setVehicle("mtb").setWeighting("fastest"), new Profile("racingbike").setVehicle("racingbike").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
Aggregations