Search in sources :

Example 26 with Profile

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);
}
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 27 with Profile

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);
}
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 28 with Profile

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);
}
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 29 with Profile

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);
}
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 30 with Profile

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);
}
Also used : ArrayList(java.util.ArrayList) GraphHopper(com.graphhopper.GraphHopper) File(java.io.File) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile) LMProfile(com.graphhopper.config.LMProfile) Test(org.junit.jupiter.api.Test)

Aggregations

Profile (com.graphhopper.config.Profile)203 LMProfile (com.graphhopper.config.LMProfile)167 CHProfile (com.graphhopper.config.CHProfile)164 Test (org.junit.jupiter.api.Test)138 CustomProfile (com.graphhopper.routing.weighting.custom.CustomProfile)84 GraphHopper (com.graphhopper.GraphHopper)54 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)54 GHPoint (com.graphhopper.util.shapes.GHPoint)35 ArrayList (java.util.ArrayList)29 File (java.io.File)25 GraphHopperServerConfiguration (com.graphhopper.application.GraphHopperServerConfiguration)19 GraphHopperServerTestConfiguration (com.graphhopper.application.util.GraphHopperServerTestConfiguration)19 PMap (com.graphhopper.util.PMap)14 SRTMProvider (com.graphhopper.reader.dem.SRTMProvider)11 BeforeAll (org.junit.jupiter.api.BeforeAll)10 Weighting (com.graphhopper.routing.weighting.Weighting)9 LocationIndexTree (com.graphhopper.storage.index.LocationIndexTree)8 TranslationMap (com.graphhopper.util.TranslationMap)7 Snap (com.graphhopper.storage.index.Snap)6 GHRequest (com.graphhopper.GHRequest)5