public GraphHopper init(CmdArgs args) throws IOException { if (!Helper.isEmpty(args.get("config", ""))) { CmdArgs tmp = CmdArgs.readFromConfig(args.get("config", ""), "graphhopper.config"); // command line configuration overwrites the ones in the config file tmp.merge(args); args = tmp; } String tmpOsmFile = args.get("osmreader.osm", ""); if (!Helper.isEmpty(tmpOsmFile)) osmFile = tmpOsmFile; String graphHopperFolder = args.get("graph.location", ""); if (Helper.isEmpty(graphHopperFolder) && Helper.isEmpty(ghLocation)) { if (Helper.isEmpty(osmFile)) throw new IllegalArgumentException("You need to specify an OSM file."); graphHopperFolder = Helper.pruneFileEnd(osmFile) + "-gh"; } // graph setGraphHopperLocation(graphHopperFolder); expectedCapacity = args.getLong("graph.expectedCapacity", expectedCapacity); defaultSegmentSize = args.getInt("graph.dataaccess.segmentSize", defaultSegmentSize); String dataAccess = args.get("graph.dataaccess", "RAM_STORE").toUpperCase(); if (dataAccess.contains("MMAP")) { setMemoryMapped(); } else { if (dataAccess.contains("SAVE") || dataAccess.contains("INMEMORY")) throw new IllegalStateException( "configuration names for dataAccess changed. Use eg. RAM or RAM_STORE"); if (dataAccess.contains("RAM_STORE")) setInMemory(true, true); else setInMemory(true, false); } if (dataAccess.contains("SYNC")) dataAccessType = new DAType(dataAccessType, true); sortGraph = args.getBool("graph.doSort", sortGraph); removeZipped = args.getBool("graph.removeZipped", removeZipped); // prepare doPrepare = args.getBool("prepare.doPrepare", doPrepare); String chShortcuts = args.get("prepare.chShortcuts", "no"); boolean levelGraph = "true".equals(chShortcuts) || "fastest".equals(chShortcuts) || "shortest".equals(chShortcuts); if (levelGraph) setCHShortcuts(true, !"shortest".equals(chShortcuts)); if (args.has("prepare.updates.periodic")) periodicUpdates = args.getInt("prepare.updates.periodic", periodicUpdates); if (args.has("prepare.updates.lazy")) lazyUpdates = args.getInt("prepare.updates.lazy", lazyUpdates); if (args.has("prepare.updates.neighbor")) neighborUpdates = args.getInt("prepare.updates.neighbor", neighborUpdates); // routing defaultAlgorithm = args.get("routing.defaultAlgorithm", defaultAlgorithm); // osm import wayPointMaxDistance = args.getDouble("osmreader.wayPointMaxDistance", wayPointMaxDistance); String type = args.get("osmreader.acceptWay", "CAR"); encodingManager = new EncodingManager(type); workerThreads = args.getInt("osmreader.workerThreads", workerThreads); enableInstructions = args.getBool("osmreader.instructions", enableInstructions); // index preciseIndexResolution = args.getInt("index.highResolution", preciseIndexResolution); return this; }