Hi!
I’m working on a project that involves route calculations for ambulances using GraphHopper 7.0. I really like how GraphHopper can
be customized.
In order to analyze the time to arrival I wanted to modify the speed limits (making them higher) according to the type of road, but I haven’t been successful despite trying several alternatives.
I tried custom models with speed statements but I cannot multiply by a higher number and the limit works by having the max velocity as the upper bound.
I saw some examples using CarFlagEncoder but I think that is not part of the API anymore. The same happens with setEncodingManager.
Could anyone guide me on how to dynamically override or ignore the default speed limits in GraphHopper?
Thank you very much!
A stub of what I am doing in the default mode:
hopper = new GraphHopper();
hopper.setOSMFile(path);
CustomModel model = new CustomModel();
Profile customProfile = new CustomProfile("car_custom")
.setCustomModel(model)
.setVehicle("car");
hopper.setProfiles(customProfile);
LMProfile lm_profile = new LMProfile("car_custom");
hopper.getLMPreparationHandler().setLMProfiles(lm_profile);
hopper.importOrLoad();
GHRequest req = new GHRequest(startLat, startLon, endLat, endLon);
CustomModel model = new CustomModel();
# I tired some combinations of limit and multiply but always works for doing it
# less velocity than the maximum. Not higher
#model.addToSpeed(
# com.graphhopper.json.Statement.If(
# "true",
# com.graphhopper.json.Statement.Op.MULTIPLY, "0.9"));
req.setCustomModel(model);
req.setProfile("car_custom")
.setLocale(Locale.US);
GHResponse rsp = hopper.route(req);