Search in sources :

Example 36 with Profile

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

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

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

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());
}
Also used : LMProfile(com.graphhopper.config.LMProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile) GraphHopperConfig(com.graphhopper.GraphHopperConfig) Test(org.junit.jupiter.api.Test)

Example 40 with Profile

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;
}
Also used : GraphHopper(com.graphhopper.GraphHopper) Profile(com.graphhopper.config.Profile)

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