I’m new at Graphhopper and I’m trying to create my own custom weighting class for testing purposes. I want to write my own weighting formula in the calcEdgeWeight method, meaning i need to access the edges properties (speed, priority and distance) and I don’t know how to do it.
Are you trying to use your own version of the CustomWeighting class to use the yaml/json syntax, or would you just like to write your own Weighting from scratch?
Take a look at DefaultWeightingFactory. You can return your own implementation of the Weighting interface there. There you already have access to encodingManager, which allows you to read the edge properties. For example a very simple weighting based on road class might look like this:
Thank you very much for your quick answer, it’s clear for me now!
I just have one last question. I want this weighting to be used only for a foot
profile, what changes in my java code and in the config file do I need to perform?