public static void main(String[] strs) throws Exception { CmdArgs args = CmdArgs.read(strs); GraphHopper hopper = new GraphHopperOSM().init(args).importOrLoad(); boolean debug = args.getBool("minigraphui.debug", false); new MiniGraphUI(hopper, debug).visualize(); }
public String getOSMFile() { return getDataReaderFile(); }
@Override protected DataReader createReader(GraphHopperStorage ghStorage) { return initDataReader(new OSMReader(ghStorage)); }
public GraphHopperManaged(CmdArgs configuration, ObjectMapper objectMapper) { String splitAreaLocation = configuration.get(Parameters.Landmark.PREPARE + "split_area_location", ""); JsonFeatureCollection landmarkSplittingFeatureCollection; try (Reader reader = splitAreaLocation.isEmpty() ? new InputStreamReader(LandmarkStorage.class.getResource("map.geo.json").openStream(), UTF_CS) : new InputStreamReader(new FileInputStream(splitAreaLocation), UTF_CS)) { landmarkSplittingFeatureCollection = objectMapper.readValue(reader, JsonFeatureCollection.class); } catch (IOException e1) { logger.error("Problem while reading border map GeoJSON. Skipping this.", e1); landmarkSplittingFeatureCollection = null; } graphHopper = new GraphHopperOSM(landmarkSplittingFeatureCollection).forServer(); String spatialRuleLocation = configuration.get("spatial_rules.location", ""); if (!spatialRuleLocation.isEmpty()) { final BBox maxBounds = BBox.parseBBoxString(configuration.get("spatial_rules.max_bbox", "-180, 180, -90, 90")); try (final InputStreamReader reader = new InputStreamReader(new FileInputStream(spatialRuleLocation), UTF_CS)) { JsonFeatureCollection jsonFeatureCollection = objectMapper.readValue(reader, JsonFeatureCollection.class); SpatialRuleLookupHelper.buildAndInjectSpatialRuleIntoGH(graphHopper, maxBounds, jsonFeatureCollection); } catch (IOException e) { throw new RuntimeException(e); } } graphHopper.init(configuration); }
if (((GraphHopperOSM)hopper).getOSMFile().equals(file.getAbsolutePath())) return; hopper = new GraphHopperOSM(). setOSMFile(file.getAbsolutePath()). forDesktop(). setEncodingManager(new EncodingManager(getAvailableTravelModeNames(), BYTES_FOR_EDGE_FLAGS)). setCHEnabled(false).
count = args.getInt("count"); GraphHopper graphHopper = new GraphHopperOSM(); graphHopper.init(graphHopperConfiguration).forDesktop(); graphHopper.getCHFactoryDecorator().setEnabled(false);
@Override protected void loadOrPrepareLM() { if (!getLMFactoryDecorator().isEnabled() || getLMFactoryDecorator().getPreparations().isEmpty()) return; if (landmarkSplittingFeatureCollection != null && !landmarkSplittingFeatureCollection.getFeatures().isEmpty()) { SpatialRuleLookup ruleLookup = SpatialRuleLookupBuilder.buildIndex(landmarkSplittingFeatureCollection, "area", new SpatialRuleLookupBuilder.SpatialRuleFactory() { @Override public SpatialRule createSpatialRule(final String id, List<Polygon> polygons) { return new DefaultSpatialRule() { @Override public String getId() { return id; } }.setBorders(polygons); } }); for (PrepareLandmarks prep : getLMFactoryDecorator().getPreparations()) { // the ruleLookup splits certain areas from each other but avoids making this a permanent change so that other algorithms still can route through these regions. if (ruleLookup != null && ruleLookup.size() > 0) { prep.setSpatialRuleLookup(ruleLookup); } } } super.loadOrPrepareLM(); } }
@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(); }
@Override protected DataReader createReader(GraphHopperStorage ghStorage) { return initDataReader(new OSMReader(ghStorage)); }
public String getOSMFile() { return getDataReaderFile(); }
CmdArgs graphHopperConfiguration = new CmdArgs(); graphHopperConfiguration.put("graph.location", "graph-cache"); GraphHopper hopper = new GraphHopperOSM().init(graphHopperConfiguration); hopper.getCHFactoryDecorator().setEnabled(false); System.out.println("loading graph from cache");