Hi
I am new to Graphhopper, I am trying to resolve the speed limit from a GPS coordinate and was wondering if this is possible ?
My Plan was to do the fllowing:
val index = hopper.locationIndex
val snap = index.findClosest(lat, lon, EdgeFilter.ALL_EDGES)
val maxSpeedEnc = hopper.encodingManager.getDecimalEncodedValue(MaxSpeed.KEY)
val max_speed = snap.closestEdge.get(maxSpeedEnc)
However I find that every edge the max speed is Infinity
I also saw the max speed calculator and tried adding this so that it always resolves a speed limit, however this causes a crash when loading up the graph, see below:
var hopper: GraphHopper = GraphHopper()
hopper.osmFile = "south-africa-latest.osm.pbf"
hopper.graphHopperLocation = "cache"
hopper.setEncodedValuesString("car_access, car_average_speed, max_speed");
hopper.setProfiles(Profile("car").setCustomModel(GHUtility.loadCustomModelFromJar("car.json")));
hopper.setMaxSpeedCalculator(MaxSpeedCalculator(MaxSpeedCalculator.createLegalDefaultSpeeds()))
hopper.chPreparationHandler.setCHProfiles(CHProfile("car"));
hopper.importOrLoad()
This however crashes with the below exception:
java.lang.IllegalArgumentException
at java.base/java.util.concurrent.ForkJoinPool.<init>(ForkJoinPool.java:2708)
at java.base/java.util.concurrent.ForkJoinPool.<init>(ForkJoinPool.java:2578)
at com.graphhopper.util.GHUtility.runConcurrently(GHUtility.java:506)
at com.graphhopper.routing.util.RoadDensityCalculator.calcRoadDensities(RoadDensityCalculator.java:65)
at com.graphhopper.routing.util.UrbanDensityCalculator.calcResidential(UrbanDensityCalculator.java:80)
at com.graphhopper.routing.util.UrbanDensityCalculator.calcUrbanDensity(UrbanDensityCalculator.java:52)
at com.graphhopper.GraphHopper.calculateUrbanDensity(GraphHopper.java:949)
at com.graphhopper.GraphHopper.postImportOSM(GraphHopper.java:881)
at com.graphhopper.GraphHopper.process(GraphHopper.java:813)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:763)
Any advice would be much appreciated, thank you