Search in sources :

Example 16 with LMProfile

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

the class MapMatching2Test method testIssue70.

@Test
public void testIssue70() throws IOException {
    GraphHopper hopper = new GraphHopper();
    hopper.setOSMFile("../map-matching/files/issue-70.osm.gz");
    hopper.setGraphHopperLocation(GH_LOCATION);
    hopper.setProfiles(new Profile("my_profile").setVehicle("car").setWeighting("fastest"));
    hopper.getLMPreparationHandler().setLMProfiles(new LMProfile("my_profile"));
    hopper.importOrLoad();
    MapMatching mapMatching = new MapMatching(hopper, new PMap().putObject("profile", "my_profile"));
    Gpx gpx = xmlMapper.readValue(getClass().getResourceAsStream("/issue-70.gpx"), Gpx.class);
    MatchResult mr = mapMatching.match(GpxConversions.getEntries(gpx.trk.get(0)));
    assertEquals(Arrays.asList("Милана Видака", "Бранка Радичевића", "Здравка Челара"), fetchStreets(mr.getEdgeMatches()));
    for (EdgeMatch edgeMatch : mr.getEdgeMatches()) {
        validateEdgeMatch(edgeMatch);
    }
}
Also used : MapMatching(com.graphhopper.matching.MapMatching) EdgeMatch(com.graphhopper.matching.EdgeMatch) PMap(com.graphhopper.util.PMap) LMProfile(com.graphhopper.config.LMProfile) GraphHopper(com.graphhopper.GraphHopper) MatchResult(com.graphhopper.matching.MatchResult) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile) Gpx(com.graphhopper.jackson.Gpx) Test(org.junit.jupiter.api.Test)

Example 17 with LMProfile

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

the class RoutingAdditivityTest method setup.

@BeforeAll
public static void setup() {
    Helper.removeDir(new File(GH_LOCATION));
    graphHopper = new GraphHopper();
    graphHopper.setOSMFile("../map-matching/files/leipzig_germany.osm.pbf");
    graphHopper.setGraphHopperLocation(GH_LOCATION);
    graphHopper.setProfiles(new Profile("my_profile").setVehicle("car").setWeighting("fastest"));
    graphHopper.getLMPreparationHandler().setLMProfiles(new LMProfile("my_profile"));
    graphHopper.importOrLoad();
}
Also used : LMProfile(com.graphhopper.config.LMProfile) GraphHopper(com.graphhopper.GraphHopper) File(java.io.File) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 18 with LMProfile

use of com.graphhopper.config.LMProfile 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 19 with LMProfile

use of com.graphhopper.config.LMProfile 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 20 with LMProfile

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

the class RouteResourceIssue2020Test method createConfig.

private static GraphHopperServerConfiguration createConfig() {
    GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
    config.getGraphHopperConfiguration().putObject("graph.flag_encoders", "car").putObject("prepare.lm.split_area_location", "../core/files/split.geo.json").putObject("datareader.file", "../core/files/north-bayreuth.osm.gz").putObject("graph.encoded_values", "road_class,surface,road_environment,max_speed").putObject("graph.location", DIR).setProfiles(Collections.singletonList(new Profile("my_car").setVehicle("car").setWeighting("fastest"))).setLMProfiles(Collections.singletonList(new LMProfile("my_car")));
    return config;
}
Also used : GraphHopperServerConfiguration(com.graphhopper.application.GraphHopperServerConfiguration) GraphHopperServerTestConfiguration(com.graphhopper.application.util.GraphHopperServerTestConfiguration) LMProfile(com.graphhopper.config.LMProfile) Profile(com.graphhopper.config.Profile) LMProfile(com.graphhopper.config.LMProfile)

Aggregations

LMProfile (com.graphhopper.config.LMProfile)48 Profile (com.graphhopper.config.Profile)41 CHProfile (com.graphhopper.config.CHProfile)33 Test (org.junit.jupiter.api.Test)24 CustomProfile (com.graphhopper.routing.weighting.custom.CustomProfile)15 PMap (com.graphhopper.util.PMap)12 GraphHopper (com.graphhopper.GraphHopper)10 GraphHopperServerConfiguration (com.graphhopper.application.GraphHopperServerConfiguration)6 GraphHopperServerTestConfiguration (com.graphhopper.application.util.GraphHopperServerTestConfiguration)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 CHProfileSelectorTest (com.graphhopper.routing.ch.CHProfileSelectorTest)4 LMProfileSelectorTest (com.graphhopper.routing.lm.LMProfileSelectorTest)4 File (java.io.File)4 GraphHopperConfig (com.graphhopper.GraphHopperConfig)3 Gpx (com.graphhopper.jackson.Gpx)3 EdgeMatch (com.graphhopper.matching.EdgeMatch)3 MapMatching (com.graphhopper.matching.MapMatching)3 MatchResult (com.graphhopper.matching.MatchResult)3 ProfileResolver (com.graphhopper.routing.ProfileResolver)3 GHPoint (com.graphhopper.util.shapes.GHPoint)3