use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method missingVehicle_multiplePossibilities_throws.
@Test
public void missingVehicle_multiplePossibilities_throws() {
List<Profile> profiles = Arrays.asList(fastBike, fastCar);
List<CHProfile> chProfiles = Arrays.asList(new CHProfile("fast_bike"), new CHProfile("fast_car"));
assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, null, "fastest", null, null);
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method createHopper.
/**
* Creates a {@link GraphHopper} instance with some default settings for this test. The settings can
* be adjusted before calling {@link GraphHopper#importOrLoad()}
*/
private GraphHopper createHopper(String osmFile, Profile... profiles) {
GraphHopper hopper = new GraphHopper().setStoreOnFlush(true).setOSMFile(osmFile).setProfiles(profiles).setGraphHopperLocation(GH_LOCATION);
hopper.getRouterConfig().setSimplifyResponse(false);
hopper.setMinNetworkSize(0);
hopper.getReaderConfig().setMaxWayPointDistance(0);
hopper.getLMPreparationHandler().setLMProfiles(new LMProfile(profiles[0].getName()));
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile(profiles[0].getName()));
return hopper;
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class GraphHopperLandmarksTest method createConfig.
private static GraphHopperServerConfiguration createConfig() {
GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration();
config.getGraphHopperConfiguration().putObject("graph.flag_encoders", "car").putObject("datareader.file", "../core/files/belarus-east.osm.gz").putObject("prepare.min_network_size", 0).putObject("graph.location", DIR).putObject("prepare.lm.min_network_size", 2).setProfiles(Collections.singletonList(new Profile("car_profile").setVehicle("car").setWeighting("fastest"))).setCHProfiles(Collections.singletonList(new CHProfile("car_profile"))).setLMProfiles(Collections.singletonList(new LMProfile("car_profile")));
return config;
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class GraphHopperConfig method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("profiles:\n");
for (Profile profile : profiles) {
sb.append(profile);
sb.append("\n");
}
sb.append("profiles_ch:\n");
for (CHProfile profile : chProfiles) {
sb.append(profile);
sb.append("\n");
}
sb.append("profiles_lm:\n");
for (LMProfile profile : lmProfiles) {
sb.append(profile);
sb.append("\n");
}
sb.append("properties:\n");
for (Map.Entry<String, Object> entry : map.toMap().entrySet()) {
sb.append(entry.getKey()).append(": ").append(entry.getValue());
sb.append("\n");
}
return sb.toString();
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class GraphHopperTest method testRoundaboutInstructionsWithCH.
@Test
public void testRoundaboutInstructionsWithCH() {
final String profile1 = "my_profile";
final String profile2 = "your_profile";
final String vehicle1 = "car";
final String vehicle2 = "bike";
final String weighting = "fastest";
GraphHopper hopper = new GraphHopper().setGraphHopperLocation(GH_LOCATION).setOSMFile(MONACO).setProfiles(Arrays.asList(new Profile(profile1).setVehicle(vehicle1).setWeighting(weighting), new Profile(profile2).setVehicle(vehicle2).setWeighting(weighting))).setStoreOnFlush(true);
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile(profile1), new CHProfile(profile2));
hopper.setMinNetworkSize(0);
hopper.importOrLoad();
assertEquals(2, hopper.getCHGraphs().size());
GHResponse rsp = hopper.route(new GHRequest(43.745084, 7.430513, 43.745247, 7.430347).setProfile(profile1));
ResponsePath res = rsp.getBest();
assertEquals(2, ((RoundaboutInstruction) res.getInstructions().get(1)).getExitNumber());
rsp = hopper.route(new GHRequest(43.745968, 7.42907, 43.745832, 7.428614).setProfile(profile1));
res = rsp.getBest();
assertEquals(2, ((RoundaboutInstruction) res.getInstructions().get(1)).getExitNumber());
rsp = hopper.route(new GHRequest(43.745948, 7.42914, 43.746173, 7.428834).setProfile(profile1));
res = rsp.getBest();
assertEquals(1, ((RoundaboutInstruction) res.getInstructions().get(1)).getExitNumber());
rsp = hopper.route(new GHRequest(43.735817, 7.417096, 43.735666, 7.416587).setProfile(profile1));
res = rsp.getBest();
assertEquals(2, ((RoundaboutInstruction) res.getInstructions().get(1)).getExitNumber());
}
Aggregations