Adding a new weighting tag to grapphhopper routing based on gpx tracks


I’m quite new with graphhopper. I would like to use graphhopper’s routing engine to generate routes, weighted by existing gpx tracks: the more a way has been taken, the more its weight will be important.

I already have my weights for all OSM way, stored in a Postgis database with the OSM ways IDs, and I know would like to add them to graphhopper.

For this, I saw 2 options :

  • Adding a new encoded value to graphhopper and creting a new flag, and then use it in a custom model
  • Creating a new weighting class, like the FastestWeighting, that includes my own weight

Which option would you recommend? Is there any other option to do so?

I would go with a new encoded value and use this in the custom_model.

Is there any existing tutorial or documentation decribing how to create an EncodedValue ?
I’ve found some discussions detailling some of the classes to extend here :

I tried to inspire from this discussions, and develop new java classes, but I’m not sure if I’m going the right way.
I created an EncodedValue file, extended the EncodedValueFactory with my new EV, and extend the TagParser class with a CustomTagParser, but it didn’t worked yet

Which version do you use? Latest master, or something like 5.3? A few things have changed in master since 5.3.

I’m using the 5.3 version yet, and i saw that some classes had changed since the latest topics I saw were published

Powered by Discourse