Search in sources :

Example 21 with CHProfile

use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.

the class RouteResourceClientHCTest method createConfig.

private static GraphHopperServerConfiguration createConfig() {
    GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
    config.getGraphHopperConfiguration().putObject("graph.flag_encoders", "car,bike").putObject("prepare.min_network_size", 0).putObject("graph.elevation.provider", "srtm").putObject("graph.elevation.cache_dir", "../core/files/").putObject("datareader.file", "../core/files/andorra.osm.pbf").putObject("graph.encoded_values", "road_class,surface,road_environment,max_speed").putObject("graph.location", DIR).setProfiles(Arrays.asList(new Profile("my_car").setVehicle("car").setWeighting("fastest"), new Profile("my_bike").setVehicle("bike").setWeighting("fastest"))).setCHProfiles(Arrays.asList(new CHProfile("my_car"), new CHProfile("my_bike")));
    return config;
}
Also used : CHProfile(com.graphhopper.config.CHProfile) GraphHopperServerConfiguration(com.graphhopper.application.GraphHopperServerConfiguration) GraphHopperServerTestConfiguration(com.graphhopper.application.util.GraphHopperServerTestConfiguration) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile)

Example 22 with CHProfile

use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.

the class RouteResourceTest method createConfig.

private static GraphHopperServerConfiguration createConfig() {
    GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
    config.getGraphHopperConfiguration().putObject("profiles_mapbox", mapboxResolver).putObject("graph.flag_encoders", "car").putObject("prepare.min_network_size", 0).putObject("datareader.file", "../core/files/andorra.osm.pbf").putObject("graph.encoded_values", "road_class,surface,road_environment,max_speed").putObject("graph.location", DIR).putObject(MAX_NON_CH_POINT_DISTANCE, 10e6).setProfiles(Collections.singletonList(new Profile("my_car").setVehicle("car").setWeighting("fastest"))).setCHProfiles(Collections.singletonList(new CHProfile("my_car")));
    return config;
}
Also used : CHProfile(com.graphhopper.config.CHProfile) GraphHopperServerConfiguration(com.graphhopper.application.GraphHopperServerConfiguration) GraphHopperServerTestConfiguration(com.graphhopper.application.util.GraphHopperServerTestConfiguration) Profile(com.graphhopper.config.Profile) CHProfile(com.graphhopper.config.CHProfile)

Example 23 with CHProfile

use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.

the class RouteResourceTurnCostsTest method createConfig.

private static GraphHopperServerConfiguration createConfig() {
    GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
    config.getGraphHopperConfiguration().putObject("graph.flag_encoders", "car|turn_costs=true").putObject("prepare.min_network_size", 0).putObject("datareader.file", "../core/files/moscow.osm.gz").putObject("graph.encoded_values", "road_class,surface,road_environment,max_speed").putObject("graph.location", DIR).setProfiles(Arrays.asList(new Profile("my_car_turn_costs").setVehicle("car").setWeighting("fastest").setTurnCosts(true), new Profile("my_car_no_turn_costs").setVehicle("car").setWeighting("fastest").setTurnCosts(false), new Profile("my_custom_car_turn_costs").setVehicle("car").setWeighting("custom").setTurnCosts(true).putHint("custom_model_file", "empty"), new Profile("my_custom_car_no_turn_costs").setVehicle("car").setWeighting("custom").setTurnCosts(false).putHint("custom_model_file", "empty"))).setCHProfiles(Arrays.asList(new CHProfile("my_car_turn_costs"), new CHProfile("my_car_no_turn_costs"), new CHProfile("my_custom_car_turn_costs"), new CHProfile("my_custom_car_no_turn_costs"))).setLMProfiles(Arrays.asList(new LMProfile("my_car_no_turn_costs"), new LMProfile("my_custom_car_no_turn_costs"), // no need for a second LM preparation: we can just cross query here
    new LMProfile("my_car_turn_costs").setPreparationProfile("my_car_no_turn_costs"), new LMProfile("my_custom_car_turn_costs").setPreparationProfile("my_custom_car_no_turn_costs")));
    return config;
}
Also used : CHProfile(com.graphhopper.config.CHProfile) GraphHopperServerConfiguration(com.graphhopper.application.GraphHopperServerConfiguration) GraphHopperServerTestConfiguration(com.graphhopper.application.util.GraphHopperServerTestConfiguration) LMProfile(com.graphhopper.config.LMProfile) CHProfile(com.graphhopper.config.CHProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile)

Example 24 with CHProfile

use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.

the class RouteResourceProfileSelectionTest method createConfig.

private static GraphHopperServerConfiguration createConfig() {
    GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
    config.getGraphHopperConfiguration().putObject("graph.flag_encoders", "bike,car,foot").putObject("prepare.min_network_size", 0).putObject("datareader.file", "../core/files/monaco.osm.gz").putObject("graph.encoded_values", "road_class,surface,road_environment,max_speed").putObject("graph.location", DIR).setProfiles(Arrays.asList(new Profile("my_car").setVehicle("car").setWeighting("fastest"), new Profile("my_bike").setVehicle("bike").setWeighting("short_fastest"), new Profile("my_feet").setVehicle("foot").setWeighting("shortest"))).setCHProfiles(Arrays.asList(new CHProfile("my_car"), new CHProfile("my_bike"), new CHProfile("my_feet"))).setLMProfiles(Arrays.asList(new LMProfile("my_car"), new LMProfile("my_bike"), new LMProfile("my_feet")));
    return config;
}
Also used : CHProfile(com.graphhopper.config.CHProfile) GraphHopperServerConfiguration(com.graphhopper.application.GraphHopperServerConfiguration) GraphHopperServerTestConfiguration(com.graphhopper.application.util.GraphHopperServerTestConfiguration) LMProfile(com.graphhopper.config.LMProfile) CHProfile(com.graphhopper.config.CHProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile)

Example 25 with CHProfile

use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.

the class LMProfileSelectorTest method assertLMProfileSelectionError.

private String assertLMProfileSelectionError(String expectedError, List<Profile> profiles, List<LMProfile> lmProfiles, String vehicle, String weighting, Boolean edgeBased, Integer uTurnCosts) {
    PMap hintsMap = createHintsMap(vehicle, weighting, edgeBased, uTurnCosts);
    try {
        new ProfileResolver(encodingManager, profiles, Collections.<CHProfile>emptyList(), lmProfiles).selectProfileLM(hintsMap);
        fail("There should have been an error");
        return "";
    } catch (IllegalArgumentException e) {
        assertTrue(e.getMessage().contains(expectedError), "There should have been an error message containing:\n'" + expectedError + "'\nbut was:\n'" + e.getMessage() + "'");
        return e.getMessage();
    }
}
Also used : CHProfile(com.graphhopper.config.CHProfile) ProfileResolver(com.graphhopper.routing.ProfileResolver) PMap(com.graphhopper.util.PMap)

Aggregations

CHProfile (com.graphhopper.config.CHProfile)66 Profile (com.graphhopper.config.Profile)63 LMProfile (com.graphhopper.config.LMProfile)58 Test (org.junit.jupiter.api.Test)39 CustomProfile (com.graphhopper.routing.weighting.custom.CustomProfile)31 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)16 PMap (com.graphhopper.util.PMap)10 GHPoint (com.graphhopper.util.shapes.GHPoint)9 GraphHopperServerConfiguration (com.graphhopper.application.GraphHopperServerConfiguration)8 GraphHopperServerTestConfiguration (com.graphhopper.application.util.GraphHopperServerTestConfiguration)8 GraphHopper (com.graphhopper.GraphHopper)6 CHProfileSelectorTest (com.graphhopper.routing.ch.CHProfileSelectorTest)4 LMProfileSelectorTest (com.graphhopper.routing.lm.LMProfileSelectorTest)4 GraphHopperConfig (com.graphhopper.GraphHopperConfig)3 ProfileResolver (com.graphhopper.routing.ProfileResolver)3 CountryRuleFactory (com.graphhopper.routing.util.countryrules.CountryRuleFactory)2 LocationIndexTree (com.graphhopper.storage.index.LocationIndexTree)2 JtsModule (com.bedatadriven.jackson.datatype.jts.JtsModule)1 IntArrayList (com.carrotsearch.hppc.IntArrayList)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1