Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ void testSimpleGetRoute() {
.body("any { it.key == 'features' }", is(true))
.body("features[0].containsKey('properties')", is(true))
.body("features[0].properties.containsKey('summary')", is(true))
.body("features[0].properties.summary.distance", is(closeTo(1046.2, 1)))
.body("features[0].properties.summary.duration", is(closeTo(215.0, 1)))
.body("features[0].properties.summary.distance", is(closeTo(1142.9, 1)))
.body("features[0].properties.summary.duration", is(closeTo(255.2, 1)))
.statusCode(200);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,25 +201,25 @@ public MatrixResult computeMatrix(RoutingProfile routingProfile) throws Exceptio
String encoderName = RoutingProfileType.getEncoderName(getProfileType());
FlagEncoder flagEncoder = gh.getEncodingManager().getEncoder(encoderName);
PMap hintsMap = new PMap();
boolean hasTurnCosts = Boolean.TRUE.equals(routingProfile.getProfileProperties().getBuild().getEncoderOptions().getTurnCosts());
ProfileTools.setWeightingMethod(hintsMap, getWeightingMethodOrDefault(), getProfileType(), false);
ProfileTools.setWeighting(hintsMap, getWeightingMethodOrDefault(), getProfileType(), false);
String chProfileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), false);
String coreProfileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), true);
String profileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), hasTurnCosts);

//TODO Refactoring : probably remove MatrixAlgorithmFactory alltogether as the checks for algorithm choice have to be performed here again. Or combine in a single check nicely
try {
// RPHAST
if (!getFlexibleMode() && gh.getCHPreparationHandler().isEnabled() && routingProfile.hasCHProfile(chProfileName)) {
return computeRPHASTMatrix(gh, flagEncoder, chProfileName);
if (!getFlexibleMode() && gh.getCHPreparationHandler().isEnabled() && routingProfile.hasCHProfile(profileName)) {
return computeRPHASTMatrix(gh, flagEncoder, profileName);
}
// Core
else if (getSearchParameters().getDynamicSpeeds() && routingProfile.getGraphhopper().isCoreAvailable(coreProfileName)) {
return computeCoreMatrix(gh, flagEncoder, hintsMap, coreProfileName, routingProfile);
else if (getSearchParameters().getDynamicSpeeds() && routingProfile.getGraphhopper().isCoreAvailable(profileName)) {
return computeCoreMatrix(gh, flagEncoder, hintsMap, profileName, routingProfile);
}
// Dijkstra
else {
// use CHProfileName (w/o turn costs) since Dijkstra is node-based so turn restrictions are not used.
return computeDijkstraMatrix(gh, flagEncoder, hintsMap, chProfileName);
return computeDijkstraMatrix(gh, flagEncoder, hintsMap, profileName.replace("_with_turn_costs", ""));
}
} catch (PointNotFoundException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public void setSpeedups(GHRequest req, boolean useCH, boolean useCore, boolean u

ORSGraphHopper gh = profile().getGraphhopper();

useCH = useCH && gh.isCHAvailable(profileNameCH);
useCH = useCH && gh.isCHAvailable(requestProfileName);
useCore = useCore && !useCH && (gh.isCoreAvailable(requestProfileName) || gh.isCoreAvailable(profileNameNoTC));
useALT = useALT && !useCH && !useCore && gh.isLMAvailable(requestProfileName);

Expand All @@ -934,8 +934,8 @@ public void setSpeedups(GHRequest req, boolean useCH, boolean useCore, boolean u
req.getHints().putObject(ProfileTools.KEY_LM_DISABLE, !useALT);

if (useCH) {
req.setAlgorithm(Parameters.Algorithms.DIJKSTRA_BI);
req.setProfile(profileNameCH);
// either Dijkstra or AStar is selected downstream depending on whether node- or egde-based CH is being used
req.setAlgorithm("");
}
if (useCore && !gh.isCoreAvailable(requestProfileName) && gh.isCoreAvailable(profileNameNoTC))
// fallback to a core profile without turn costs if one is available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static ORSGraphHopperConfig createGHSettings(ProfileProperties profile, E
List<CHProfile> chProfiles = new ArrayList<>();
String chWeightingsString = StringUtility.trimQuotes(chOpts.getWeightings());
for (String weighting : chWeightingsString.split(","))
chProfiles.add(new CHProfile(ProfileTools.makeProfileName(vehicle, weighting, false)));
chProfiles.add(new CHProfile(ProfileTools.makeProfileName(vehicle, weighting, hasTurnCosts)));
ghConfig.setCHProfiles(chProfiles);
}
}
Expand Down
Loading