public static CmdArgs readFromSystemProperties() { CmdArgs cmdArgs = new CmdArgs(); for (Entry<Object, Object> e : System.getProperties().entrySet()) { String k = ((String) e.getKey()); String v = ((String) e.getValue()); if (k.startsWith("graphhopper.")) { k = k.substring("graphhopper.".length()); cmdArgs.put(k, v); } } return cmdArgs; }
@Test public void testPrepareWeightingNo() { CmdArgs args = new CmdArgs(); args.put(Parameters.Landmark.PREPARE + "weightings", "fastest"); LMAlgoFactoryDecorator dec = new LMAlgoFactoryDecorator(); dec.init(args); assertTrue(dec.isEnabled()); // See #1076 args.put(Parameters.Landmark.PREPARE + "weightings", "no"); dec = new LMAlgoFactoryDecorator(); dec.init(args); assertFalse(dec.isEnabled()); } }
public static CmdArgs readFromSystemProperties() { CmdArgs cmdArgs = new CmdArgs(); for (Entry<Object, Object> e : System.getProperties().entrySet()) { String k = ((String) e.getKey()); String v = ((String) e.getValue()); if (k.startsWith("graphhopper.")) { k = k.substring("graphhopper.".length()); cmdArgs.put(k, v); } } return cmdArgs; }
/** * @param fileStr the file name of config.properties * @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config */ public static CmdArgs readFromConfig(String fileStr, String systemProperty) throws IOException { if (systemProperty.startsWith("-D")) systemProperty = systemProperty.substring(2); String configLocation = System.getProperty(systemProperty); if (Helper.isEmpty(configLocation)) configLocation = fileStr; Map<String, String> map = new LinkedHashMap<String, String>(); Helper.loadProperties(map, new InputStreamReader(new FileInputStream( new File(configLocation).getAbsoluteFile()), Helper.UTF_CS)); CmdArgs args = new CmdArgs(); args.merge(map); // overwrite with system settings Properties props = System.getProperties(); for (Entry<Object, Object> e : props.entrySet()) { String k = ((String) e.getKey()); String v = ((String) e.getValue()); if (k.startsWith("graphhopper.")) { k = k.substring("graphhopper.".length()); args.put(k, v); } } return args; }
/** * @param fileStr the file name of config.properties * @param systemProperty the property name of the configuration. E.g. -Dgraphhopper.config */ public static CmdArgs readFromConfig( String fileStr, String systemProperty ) throws IOException { if (systemProperty.startsWith("-D")) systemProperty = systemProperty.substring(2); String configLocation = System.getProperty(systemProperty); if (Helper.isEmpty(configLocation)) configLocation = fileStr; Map<String, String> map = new LinkedHashMap<String, String>(); Helper.loadProperties(map, new InputStreamReader(new FileInputStream( new File(configLocation).getAbsoluteFile()), Helper.UTF_CS)); CmdArgs args = new CmdArgs(); args.merge(map); // overwrite with system settings Properties props = System.getProperties(); for (Entry<Object, Object> e : props.entrySet()) { String k = ((String) e.getKey()); String v = ((String) e.getValue()); if (k.startsWith("graphhopper.")) { k = k.substring("graphhopper.".length()); args.put(k, v); } } return args; }
@Override public void run(Bootstrap<?> bootstrap, Namespace args) { CmdArgs graphHopperConfiguration = new CmdArgs(); graphHopperConfiguration.put("graph.flag_encoders", args.getString("vehicle")); graphHopperConfiguration.put("datareader.file", args.getString("datasource")); graphHopperConfiguration.put("graph.location", "graph-cache"); GraphHopper hopper = new GraphHopperOSM().init(graphHopperConfiguration); hopper.getCHFactoryDecorator().setEnabled(false); hopper.importOrLoad(); }
graphHopperConfiguration.put("graph.location", "graph-cache"); seed = args.getLong("seed"); count = args.getInt("count");
@Override public void run(Bootstrap bootstrap, Namespace args) { CmdArgs graphHopperConfiguration = new CmdArgs(); graphHopperConfiguration.put("graph.location", "graph-cache"); GraphHopper hopper = new GraphHopperOSM().init(graphHopperConfiguration); hopper.getCHFactoryDecorator().setEnabled(false);
private void start(CmdArgs args) { String action = args.get("action", "").toLowerCase(); args.put("graph.location", "./graph-cache"); if (action.equals("import")) { String vehicle = args.get("vehicle", "car").toLowerCase(); args.put("graph.flag_encoders", vehicle); args.put("osmreader.osm", args.get("datasource", "")); args.put("prepare.min_network_size", 200); args.put("prepare.min_one_way_network_size", 200); GraphHopper hopper = new GraphHopper().init(args); hopper.getCHFactoryDecorator().setEnabled(false);