diff --git a/CHANGELOG.md b/CHANGELOG.md index b595c40564..ba4632c0e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ RELEASING: ### Fixed - prioritize graph build date over data date in routing request ([#925](https://github.com/GIScience/openrouteservice/issues/925)) +- Config file parameter to set the number of active landmarks for core routing ([#930](https://github.com/GIScience/openrouteservice/issues/930)) ## [6.4.3] - 2021-04-28 ### Changed diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java b/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java index bf770e0521..52b83c913f 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/RoutingProfile.java @@ -103,6 +103,7 @@ public class RoutingProfile { private static final String VAL_ENABLED = "enabled"; private static final String KEY_THREADS = "threads"; private static final String KEY_WEIGHTINGS = "weightings"; + private static final String KEY_LMSETS = "lmsets"; private static final String KEY_MAXCELLNODES = "maxcellnodes"; private static final String KEY_METHODS_LM = "methods.lm"; private static final String KEY_LANDMARKS = "landmarks"; @@ -342,8 +343,8 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura args.put("prepare.core.threads", coreOpts.getInt(KEY_THREADS)); if (coreOpts.hasPath(KEY_WEIGHTINGS)) args.put(KEY_PREPARE_CORE_WEIGHTINGS, StringUtility.trimQuotes(coreOpts.getString(KEY_WEIGHTINGS))); - if (coreOpts.hasPath("lmsets")) - args.put("prepare.corelm.lmsets", StringUtility.trimQuotes(coreOpts.getString("lmsets"))); + if (coreOpts.hasPath(KEY_LMSETS)) + args.put("prepare.corelm.lmsets", StringUtility.trimQuotes(coreOpts.getString(KEY_LMSETS))); if (coreOpts.hasPath(KEY_LANDMARKS)) args.put("prepare.corelm.landmarks", coreOpts.getInt(KEY_LANDMARKS)); } @@ -354,14 +355,17 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura if (config.getExecutionOpts() != null) { Config opts = config.getExecutionOpts(); if (opts.hasPath(KEY_METHODS_CH)) { - Config coreOpts = opts.getConfig(KEY_METHODS_CH); - if (coreOpts.hasPath(KEY_DISABLING_ALLOWED)) - args.put("routing.ch.disabling_allowed", coreOpts.getBoolean(KEY_DISABLING_ALLOWED)); + Config chOpts = opts.getConfig(KEY_METHODS_CH); + if (chOpts.hasPath(KEY_DISABLING_ALLOWED)) + args.put("routing.ch.disabling_allowed", chOpts.getBoolean(KEY_DISABLING_ALLOWED)); } if (opts.hasPath(KEY_METHODS_CORE)) { - Config chOpts = opts.getConfig(KEY_METHODS_CORE); - if (chOpts.hasPath(KEY_DISABLING_ALLOWED)) - args.put("routing.core.disabling_allowed", chOpts.getBoolean(KEY_DISABLING_ALLOWED)); + Config coreOpts = opts.getConfig(KEY_METHODS_CORE); + if (coreOpts.hasPath(KEY_DISABLING_ALLOWED)) + args.put("routing.core.disabling_allowed", coreOpts.getBoolean(KEY_DISABLING_ALLOWED)); + + if (coreOpts.hasPath(KEY_ACTIVE_LANDMARKS)) + args.put("routing.corelm.active_landmarks", coreOpts.getInt(KEY_ACTIVE_LANDMARKS)); } if (opts.hasPath(KEY_METHODS_LM)) { Config lmOpts = opts.getConfig(KEY_METHODS_LM); @@ -371,14 +375,6 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura if (lmOpts.hasPath(KEY_ACTIVE_LANDMARKS)) args.put("routing.lm.active_landmarks", lmOpts.getInt(KEY_ACTIVE_LANDMARKS)); } - if (opts.hasPath("methods.corelm")) { - Config lmOpts = opts.getConfig("methods.corelm"); - if (lmOpts.hasPath(KEY_DISABLING_ALLOWED)) - args.put("routing.lm.disabling_allowed", lmOpts.getBoolean(KEY_DISABLING_ALLOWED)); - - if (lmOpts.hasPath(KEY_ACTIVE_LANDMARKS)) - args.put("routing.corelm.active_landmarks", lmOpts.getInt(KEY_ACTIVE_LANDMARKS)); - } } if (config.getOptimize() && !prepareCH) diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreLMAlgoFactoryDecorator.java b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreLMAlgoFactoryDecorator.java index cd315a2215..1ea928f782 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreLMAlgoFactoryDecorator.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/core/CoreLMAlgoFactoryDecorator.java @@ -81,7 +81,7 @@ public void init(CmdArgs args) { setPreparationThreads(args.getInt(CoreLandmark.PREPARE + "threads", getPreparationThreads())); landmarkCount = args.getInt(CoreLandmark.COUNT, landmarkCount); - activeLandmarkCount = args.getInt(CoreLandmark.ACTIVE_COUNT, Math.min(4, landmarkCount)); + activeLandmarkCount = args.getInt(CoreLandmark.ACTIVE_COUNT_DEFAULT, Math.min(4, landmarkCount)); logDetails = args.getBool(CoreLandmark.PREPARE + "log_details", false); minNodes = args.getInt(CoreLandmark.PREPARE + "min_network_size", -1); diff --git a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/util/ORSParameters.java b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/util/ORSParameters.java index f50e66183f..dafd356e42 100644 --- a/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/util/ORSParameters.java +++ b/openrouteservice/src/main/java/org/heigit/ors/routing/graphhopper/extensions/util/ORSParameters.java @@ -55,7 +55,7 @@ private CoreLandmark() {} public static final String PREPARE = "prepare.corelm."; /** - * This property name in HintsMap configures at runtime if CH routing should be ignored. + * Specifies landmark sets. */ public static final String LMSETS = PREPARE + "lmsets"; /** @@ -65,7 +65,7 @@ private CoreLandmark() {} /** * Specifies how many active landmarks should be used when routing */ - public static final String ACTIVE_COUNT = ROUTING_INIT_PREFIX + "corelm.active_landmarks"; + public static final String ACTIVE_COUNT = "corelm.active_landmarks"; /** * Default for active count */