Class RoadDensityCalculator

java.lang.Object
com.graphhopper.routing.util.RoadDensityCalculator

public class RoadDensityCalculator extends Object
  • Constructor Details

    • RoadDensityCalculator

      public RoadDensityCalculator(Graph graph)
  • Method Details

    • calcRoadDensities

      public static void calcRoadDensities(Graph graph, BiConsumer<RoadDensityCalculator,EdgeIteratorState> edgeHandler, int threads)
      Loops over all edges of the graph and calls the given edgeHandler for each edge. This is done in parallel using the given number of threads. For every call we can calculate the road density using the provided thread local road density calculator.
    • calcRoadDensity

      public double calcRoadDensity(EdgeIteratorState edge, double radius, ToDoubleFunction<EdgeIteratorState> calcRoadFactor)
      Parameters:
      radius - in meters
      calcRoadFactor - weighting function. use this to define how different kinds of roads shall contribute to the calculated road density
      Returns:
      the road density in the vicinity of the given edge, i.e. the weighted road length divided by the squared radius