use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoBike.
@Test
public void testMonacoBike() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 1642, 87));
queries.add(new Query(43.727687, 7.418737, 43.74958, 7.436566, 3580, 168));
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2323, 121));
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1434, 89));
GraphHopper hopper = createHopper(MONACO, new Profile("bike").setVehicle("bike").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testBug1014.
@Test
public void testBug1014() {
List<Query> queries = new ArrayList<>();
Query query = new Query();
query.add(50.015861, 11.51041, 0, 0);
query.add(50.019129, 11.500325, 0, 0);
query.add(50.023623, 11.56929, 6777, 175);
queries.add(query);
GraphHopper hopper = createHopper(BAYREUTH, new Profile("bike").setVehicle("bike").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testAndorraPbf.
@Test
public void testAndorraPbf() {
Profile profile = new Profile("car").setVehicle("car").setWeighting("shortest");
GraphHopper hopper = createHopper(ANDORRA_PBF, profile);
hopper.importOrLoad();
checkQueries(hopper, createAndorraQueries());
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class OSMReaderTest method testOneWay.
@Test
public void testOneWay() {
GraphHopper hopper = new GraphHopperFacade(file2).setMinNetworkSize(0).importOrLoad();
GraphHopperStorage graph = hopper.getGraphHopperStorage();
assertEquals("2014-01-02T01:10:14Z", graph.getProperties().get("datareader.data.date"));
int n20 = AbstractGraphStorageTester.getIdOf(graph, 52.0);
int n22 = AbstractGraphStorageTester.getIdOf(graph, 52.133);
int n23 = AbstractGraphStorageTester.getIdOf(graph, 52.144);
int n10 = AbstractGraphStorageTester.getIdOf(graph, 51.2492152);
int n30 = AbstractGraphStorageTester.getIdOf(graph, 51.2);
assertEquals(1, GHUtility.count(carOutExplorer.setBaseNode(n10)));
assertEquals(2, GHUtility.count(carOutExplorer.setBaseNode(n20)));
assertEquals(0, GHUtility.count(carOutExplorer.setBaseNode(n30)));
EdgeIterator iter = carOutExplorer.setBaseNode(n20);
assertTrue(iter.next());
assertTrue(iter.next());
assertEquals(n30, iter.getAdjNode());
iter = carAllExplorer.setBaseNode(n20);
assertTrue(iter.next());
assertEquals(n23, iter.getAdjNode());
assertTrue(iter.get(carAccessEnc));
assertFalse(iter.getReverse(carAccessEnc));
assertTrue(iter.next());
assertEquals(n22, iter.getAdjNode());
assertFalse(iter.get(carAccessEnc));
assertTrue(iter.getReverse(carAccessEnc));
assertTrue(iter.next());
assertFalse(iter.get(carAccessEnc));
assertTrue(iter.getReverse(carAccessEnc));
assertTrue(iter.next());
assertEquals(n30, iter.getAdjNode());
assertTrue(iter.get(carAccessEnc));
assertFalse(iter.getReverse(carAccessEnc));
assertTrue(iter.next());
assertEquals(n10, iter.getAdjNode());
assertFalse(iter.get(carAccessEnc));
assertTrue(iter.getReverse(carAccessEnc));
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method createHopper.
/**
* Creates a {@link GraphHopper} instance with some default settings for this test. The settings can
* be adjusted before calling {@link GraphHopper#importOrLoad()}
*/
private GraphHopper createHopper(String osmFile, Profile... profiles) {
GraphHopper hopper = new GraphHopper().setStoreOnFlush(true).setOSMFile(osmFile).setProfiles(profiles).setGraphHopperLocation(GH_LOCATION);
hopper.getRouterConfig().setSimplifyResponse(false);
hopper.setMinNetworkSize(0);
hopper.getReaderConfig().setMaxWayPointDistance(0);
hopper.getLMPreparationHandler().setLMProfiles(new LMProfile(profiles[0].getName()));
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile(profiles[0].getName()));
return hopper;
}
Aggregations