Question about custom weighting

Hi, I’m using version 0.9 and integrate graphhopper-core and reader-osm.jar through maven.
Then I want to block certains nodes when routing and follow your sample code
But there are some problemes:

  1. no class call WeightingMap is found
  2. no constructor AvoidEdgesWeighting(FlagEncoder)

Did I miss anything?

Hi,

are you trying to override Graphhopper#createWeighting? The method looks like this: public Weighting createWeighting(HintsMap hintsMap, FlagEncoder encoder, Graph graph). The documentation seems to be outdated, thanks for pointing this out, I will update the docs.

The constructor of AvoidEdgesWeighting looks like this public AvoidEdgesWeighting(Weighting superWeighting).

Best,
Robin

Hi Robin,

Yes I’m trying. But how can I get the parameter Weighting when initialize AvoidEdgesWeighting?

Hi,

the AvoidEdgesWeighting is only used in addition with another Weighting. So you could combine it with for example the FastestWeighting or the ShortestWeighting, depending on your use-case.

Best,
Robin