@Override public GraphHopperStorage provide() { return graphHopper.getGraphHopperStorage(); }
protected Path saveDoInBackground(Void... v) throws Exception { GraphHopper tmpHopp = new GraphHopper().forMobile(); tmpHopp.load(new File(mapsFolder, currentArea).getAbsolutePath() + "-gh"); log("found graph " + tmpHopp.getGraphHopperStorage().toString() + ", nodes:" + tmpHopp.getGraphHopperStorage().getNodes()); hopper = tmpHopp; return null; }
/** * Do the 'warm up' for the specified GraphHopper instance. * * @param iterations the 'intensity' of the warm up procedure */ public static void warmUp(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); if (ghStorage == null) throw new IllegalArgumentException("The storage of GraphHopper must not be empty"); try { if (ghStorage.isCHPossible()) warmUpCHSubNetwork(graphHopper, iterations); else warmUpNonCHSubNetwork(graphHopper, iterations); } catch (Exception ex) { LOGGER.warn("Problem while sending warm up queries", ex); } }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is out of bounds: " + point, i); } } }
private static void warmUpNonCHSubNetwork(final GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(0); EdgeExplorer explorer = ghStorage.getBaseGraph().createEdgeExplorer(); for (int i = 0; i < iterations; i++) { BreadthFirstSearch bfs = new BreadthFirstSearch() { int counter = 0; @Override public boolean goFurther(int nodeId) { counter++; return counter < graphHopper.getMaxVisitedNodes(); } }; int startNode = rand.nextInt(ghStorage.getBaseGraph().getNodes() + 1); bfs.start(explorer, startNode); } } }
@Override public void start() { graphHopper.importOrLoad(); logger.info("loaded graph at:" + graphHopper.getGraphHopperLocation() + ", data_reader_file:" + graphHopper.getDataReaderFile() + ", flag_encoders:" + graphHopper.getEncodingManager() + ", " + graphHopper.getGraphHopperStorage().toDetailsString()); }
@Override protected Result check() { boolean valid = graphHopper.getGraphHopperStorage().getBounds().isValid(); if (valid) { return Result.healthy(); } else { return Result.unhealthy("GraphHopperStorage has invalid bounds."); } } }
private void printTimeOfRouteQuery(final GraphHopper hopper, final boolean ch, final boolean lm, int count, String prefix, final String vehicle, final boolean withInstructions, final int activeLandmarks, final boolean sod) { final Graph g = hopper.getGraphHopperStorage(); final AtomicLong maxDistance = new AtomicLong(0); final AtomicLong minDistance = new AtomicLong(Long.MAX_VALUE);
private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(0); for (int i = 0; i < iterations; i++) { int startNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); int endNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } }
throw new IllegalArgumentException("Point not found:" + point); Graph graph = graphHopper.getGraphHopperStorage(); QueryGraph queryGraph = new QueryGraph(graph); queryGraph.lookup(Collections.singletonList(qr));
String algo = Algorithms.ASTAR_BI; final Random rand = new Random(seed); final Graph g = hopper.getGraphHopperStorage(); final NodeAccess na = g.getNodeAccess();
" Differences will be printed to stderr."); final Random rand = new Random(seed); final Graph g = hopper.getGraphHopperStorage(); final NodeAccess na = g.getNodeAccess();
hopper.importOrLoad(); GraphHopperStorage g = hopper.getGraphHopperStorage(); String vehicleStr = args.get("graph.flag_encoders", "car"); FlagEncoder encoder = hopper.getEncodingManager().getEncoder(vehicleStr);
public MiniGraphUI(GraphHopper hopper, boolean debug) { final Graph graph = hopper.getGraphHopperStorage(); this.na = graph.getNodeAccess(); encoder = hopper.getEncodingManager().getEncoder("car"); map.put(Parameters.Landmark.DISABLE, true); weighting = hopper.getCHFactoryDecorator().getWeightings().get(0); routingGraph = hopper.getGraphHopperStorage().getGraph(CHGraph.class, weighting);
public static List<AlgoHelperEntry> createAlgos(final GraphHopper hopper, final HintsMap hints, TraversalMode tMode) { GraphHopperStorage ghStorage = hopper.getGraphHopperStorage(); LocationIndex idx = hopper.getLocationIndex(); Weighting weighting = hopper.createWeighting(hints, encoder, hopper.getGraphHopperStorage());
/** * Do the 'warm up' for the specified GraphHopper instance. * * @param iterations the 'intensity' of the warm up procedure */ public static void warmUp(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); if (ghStorage == null) throw new IllegalArgumentException("The storage of GraphHopper must not be empty"); try { if (ghStorage.isCHPossible()) warmUpCHSubNetwork(graphHopper, iterations); else warmUpNonCHSubNetwork(graphHopper, iterations); } catch (Exception ex) { LOGGER.warn("Problem while sending warm up queries", ex); } }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is out of bounds: " + point, i); } } }
private void checkIfPointsAreInBounds(List<GHPoint> points) { BBox bounds = getGraphHopperStorage().getBounds(); for (int i = 0; i < points.size(); i++) { GHPoint point = points.get(i); if (!bounds.contains(point.getLat(), point.getLon())) { throw new PointOutOfBoundsException("Point " + i + " is ouf of bounds: " + point, i); } } }
private static void warmUpNonCHSubNetwork(final GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(0); EdgeExplorer explorer = ghStorage.getBaseGraph().createEdgeExplorer(); for (int i = 0; i < iterations; i++) { BreadthFirstSearch bfs = new BreadthFirstSearch() { int counter = 0; @Override public boolean goFurther(int nodeId) { counter++; return counter < graphHopper.getMaxVisitedNodes(); } }; int startNode = rand.nextInt(ghStorage.getBaseGraph().getNodes() + 1); bfs.start(explorer, startNode); } } }
private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(0); for (int i = 0; i < iterations; i++) { int startNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); int endNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } }