Custom Profiles in GH v 9.0


After sitting on Graphhopper 7.0 I have attempted to move to 9.0.

Just wondering the new implementation to restrict and allow different roads.


I’m not sure in v9.0

Custom models - There is no-longer the option to set vehicle, how is this now handled?

new CustomProfile("paxster").setCustomModel(new CustomModel(getPaxsterModel())).setVehicle("foot")

new Profile("paxster").setCustomModel(new CustomModel(getPaxsterModel()))
(no setVehicle)

Where getPaxsterModel is

    private static CustomModel getPaxsterModel(){
        CustomModel model = new CustomModel();
        model.addToPriority(If("road_class == CONSTRUCTION", MULTIPLY, "1.0"));
        return model;

Using the following I’ve attempted to change to using custom models via the suggested .json profiles, but end up getting stuck (as I have in the past) with setting up the config.yml.


Somewhat resolved;

CustomModel model = new CustomModel();
model.addToSpeed(If("true", LIMIT, "car_average_speed"));

new Profile("paxster").setCustomModel(new CustomModel(getPaxsterModel()))

.setEncodedValuesString("road_access, road_class, car_average_speed");

Now with;
model.addToPriority(If("road_class == CONSTRUCTION", MULTIPLY, "1.0"));

File ‘priority entry’, Line 3, Column 29: “CONSTRUCTION” is neither a method, a field, nor a member class of “com.graphhopper.routing.ev.RoadClass”

Even though github has;

Maven doesn’t have;

Helpful docs

graphhopper/ at master · graphhopper/graphhopper · GitHub
graphhopper/docs/migration/ at master · graphhopper/graphhopper · GitHub

This is explained here or did this not make it clear?

CONSTRUCTION was added after 9.0, so you would have to use the current master branch to use it.


Yes, please see my initial reply to myself.

I use the following 9.1 and it isn’t there.


Ok sorry, it was also added after 9.1. It isn’t included in any release yet.

1 Like

Thanks, is there an ETA for when it will be included in the release?

I’ve just used OTHER for the moment, but it would be more reliable if there was a bit more control over it using the released version.

Currently we do approx. two releases per year. GH10 should be released around September.

1 Like

Cool, love your work. Looking forward to the next release!