Hi,
I’m using GH framework routing engine and it worked great for me until a task emerged to route monitoring complexes, that monitor only the right side of the street. By default GH builds a route like this for smaller streets
Hiya, within your setup you need to force curbside.
I’m on mobile so cannot share specific code.
This can be applied per route/point if you know your requirement before hand. I’ve only ever done between short routes of two.
You can also set turn costs to all vehicles to be unable to do uturns on a dime, so your example #2, they are then required to find a junction to complete a uturn.
Check in github for some use examples. Sorry can’t be more help at the moment.
Thanks a lot, Gregws!
It worked for me fine, though it was not that straightforward for a novice to find that I need
hopper.setEncodingManager(EncodingManager.create(“car|turn_costs=true”));
and then delete graphhopper folder contents, took some digging, still lacks documentation a bit ))
One more question: if, for some reason, I need to work with a profile with turn restrictions (i.e. edge-based), and a profile without them simultaneously, is it possible with one GraphHopper instance and one preparation set, or should I use two different instances & two folders with independent data sets?
Can’t get it work yet, need more help, sorry
First, I create an EncodingManager
hopper.setEncodingManager(EncodingManager.create(“car|turn_costs=true”));
then I’m trying to set up two profiles
hopper.setProfiles(new Profile(“car1”).setVehicle(“car”).setWeighting(“shortest”).setTurnCosts(false));
hopper.setProfiles(new Profile(“car2”).setVehicle(“car”).setWeighting(“shortest”).setTurnCosts(true));
then preparation (with clean folder, of course)
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile(“car1”));
hopper.getCHPreparationHandler().setCHProfiles(new CHProfile(“car2”));
hopper.importOrLoad();
but if I call hopper.route() with .setProfile(“car1”) it gives me
The requested profile ‘car1’ does not exist.
Available profiles: [car2]]
Thanks again! You folks really help a lot! However, real-world testing revealed one more problem: sometimes I get points that are on the left side of the one-way street (while I’m applying .setCurbsides(Arrays.asList(“right”, “right”))). Of course, I get Impossible curbside constraint: ‘curbside=right’ at point 0 … To avoid it, I need some pre-check if this curbside is really applicable, is there any nice way to do it except for parsing res.getErrors()?
And if I need not just to ignore it, but take some special actions in such case, like storing these points for further use with specially equipped cars?..
I’m afraid then your only option is to catch the error response. Or you add your own endpoint that does just the curbside check and returns true/false depending on whether it is possible or not.