Search in sources :

Example 81 with GraphHopper

use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.

the class RoutingAlgorithmWithOSMTest method testMonacoMotorcycle.

@Test
public void testMonacoMotorcycle() {
    List<Query> queries = new ArrayList<>();
    queries.add(new Query(43.730729, 7.42135, 43.727697, 7.419199, 2682, 119));
    queries.add(new Query(43.727687, 7.418737, 43.74958, 7.436566, 3728, 170));
    queries.add(new Query(43.728677, 7.41016, 43.739213, 7.4277, 3156, 165));
    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("fastest"));
    hopper.setElevationProvider(new SRTMProvider(DIR));
    hopper.importOrLoad();
    checkQueries(hopper, queries);
}
Also used : ArrayList(java.util.ArrayList) GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) SRTMProvider(com.graphhopper.reader.dem.SRTMProvider) Test(org.junit.jupiter.api.Test)

Example 82 with GraphHopper

use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.

the class RoutingAlgorithmWithOSMTest method testMonacoFoot.

@Test
public void testMonacoFoot() {
    GraphHopper hopper = createHopper(MONACO, new Profile("foot").setVehicle("foot").setWeighting("shortest"));
    hopper.importOrLoad();
    checkQueries(hopper, createMonacoFoot());
    Graph g = hopper.getGraphHopperStorage();
    // see testMonaco for a similar ID test
    assertEquals(GHUtility.asSet(2, 909, 571), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(10)));
    assertEquals(GHUtility.asSet(444, 956, 740), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(441)));
    assertEquals(GHUtility.asSet(911, 404, 122, 914), GHUtility.getNeighbors(g.createEdgeExplorer().setBaseNode(912)));
    assertEquals(43.743705, g.getNodeAccess().getLat(100), 1e-6);
    assertEquals(7.426362, g.getNodeAccess().getLon(702), 1e-6);
}
Also used : Graph(com.graphhopper.storage.Graph) GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) Test(org.junit.jupiter.api.Test)

Example 83 with GraphHopper

use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.

the class RoutingAlgorithmWithOSMTest method testAndorraFoot.

@Test
public void testAndorraFoot() {
    List<Query> queries = createAndorraQueries();
    queries.get(0).getPoints().get(1).expectedDistance = 16460;
    queries.get(0).getPoints().get(1).expectedPoints = 653;
    queries.get(1).getPoints().get(1).expectedDistance = 12839;
    queries.get(1).getPoints().get(1).expectedPoints = 435;
    queries.add(new Query(42.521269, 1.52298, 42.50418, 1.520662, 3223, 107));
    GraphHopper hopper = createHopper(ANDORRA, new Profile("foot").setVehicle("foot").setWeighting("fastest"));
    hopper.importOrLoad();
    checkQueries(hopper, queries);
}
Also used : GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) Test(org.junit.jupiter.api.Test)

Example 84 with GraphHopper

use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.

the class RoutingAlgorithmWithOSMTest method testLandmarkBug.

@Test
public void testLandmarkBug() {
    List<Query> queries = new ArrayList<>();
    Query run = new Query();
    run.add(50.016923, 11.514187, 0, 0);
    run.add(50.019129, 11.500325, 0, 0);
    run.add(50.023623, 11.56929, 7069, 178);
    queries.add(run);
    GraphHopper hopper = createHopper(BAYREUTH, new Profile("bike").setVehicle("bike").setWeighting("fastest"));
    hopper.importOrLoad();
    checkQueries(hopper, queries);
}
Also used : ArrayList(java.util.ArrayList) GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) Test(org.junit.jupiter.api.Test)

Example 85 with GraphHopper

use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.

the class RoutingAlgorithmWithOSMTest method testNorthBayreuthHikeFastestAnd3D.

@Test
public void testNorthBayreuthHikeFastestAnd3D() {
    List<Query> queries = new ArrayList<>();
    // prefer hiking route 'Teufelsloch Unterwaiz' and 'Rotmain-Wanderweg'
    queries.add(new Query(49.974972, 11.515657, 49.991022, 11.512299, 2384, 93));
    // prefer hiking route 'Markgrafenweg Bayreuth Kulmbach' but avoid tertiary highway from Pechgraben
    queries.add(new Query(49.990967, 11.545258, 50.023182, 11.555386, 4746, 119));
    GraphHopper hopper = createHopper(BAYREUTH, new Profile("hike").setVehicle("hike").setWeighting("fastest"));
    hopper.setElevationProvider(new SRTMProvider(DIR));
    hopper.importOrLoad();
    checkQueries(hopper, queries);
}
Also used : ArrayList(java.util.ArrayList) GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) SRTMProvider(com.graphhopper.reader.dem.SRTMProvider) Test(org.junit.jupiter.api.Test)

Aggregations

GraphHopper (com.graphhopper.GraphHopper)101 Test (org.junit.jupiter.api.Test)62 Profile (com.graphhopper.config.Profile)52 LMProfile (com.graphhopper.config.LMProfile)44 CHProfile (com.graphhopper.config.CHProfile)39 GraphHopperTest (com.graphhopper.GraphHopperTest)25 ArrayList (java.util.ArrayList)24 File (java.io.File)16 Test (org.junit.Test)11 SRTMProvider (com.graphhopper.reader.dem.SRTMProvider)10 GHRequest (com.graphhopper.GHRequest)7 GHResponse (com.graphhopper.GHResponse)7 GraphHopperConfig (com.graphhopper.GraphHopperConfig)6 GraphHopperOSM (com.graphhopper.reader.osm.GraphHopperOSM)6 EncodingManager (com.graphhopper.routing.util.EncodingManager)6 PMap (com.graphhopper.util.PMap)6 GHPoint (com.graphhopper.util.shapes.GHPoint)5 IOException (java.io.IOException)5 Gpx (com.graphhopper.jackson.Gpx)4 MapMatching (com.graphhopper.matching.MapMatching)4