Hello,
Is it possible to modify the formula for the weighting directly? Instead of using the .json files.
“edge_weight = edge_distance / (speed * priority) + edge_distance * distance_influence”
Thank you.
Hello,
Is it possible to modify the formula for the weighting directly? Instead of using the .json files.
“edge_weight = edge_distance / (speed * priority) + edge_distance * distance_influence”
Thank you.
It is possible by changing the Java code, but not simply by modifying the configuration file/profiles. What kind of change do you have in mind by the way? We are also looking into different variations of the formula.
Hello, sorry for the late response. I am working on an efficient navigation module, focused in electric vehicles. I have implemented a formula considering different parameters, such as altitude, drag coefficient, temperature, etc in python using osm and I would like to integrate this work with graphhopper. If you could help me to identify where in the code I can modify the formula it would be really helpful. Thank you un advance.
It might be easiest to write your own implementation of Weighting.java
. Another approach would be using CustomWeighting.java
, which you can configure in json/yaml, but this approach might be too limited.
Ok, I will try to modify that file. Just to confirm, is the one in this path, right?
core/src/main/java/com/graphhopper/routing/weighting/Weighting.java
Thank you.
Yes, that’s the interface you need to implement. You can add your implementation to DefaultWeightingFactory.java
and use it via the weighting
field in your profile.