Except=bus OR except=psv tags are not considered for "vehicle":"car"

I am using graphhopper-core 7.0 version for Bus routing. I am using “vehicle”: “car” for my “profile”:“bus”. However I noticed, that for turn restrictions the except=bus or except=psv tags, are not considered. I am also using “transportation_mode”:“BUS”, so that following tags in the OSMRoadAccessParser are considered:
case BUS:
return Arrays.asList(“bus”, “psv”, “motor_vehicle”, “vehicle”, “access”);
but it does not work.

If I use “vehicle”: “roads” with “transportation_mode”:“BUS”, then it works, but then there is the other stuff that is not available in RoadsAccessParser, which we have in CarAccessParser e.g. oneway handling, restriction handling, barrier handling etc.

Is there any way using “vehicle”: “car” with “transportation_mode”:“BUS” to consider except=bus & except=psv tags?


Did you have a look into this issue? New profile for busses by DanielAMCON · Pull Request #2710 · graphhopper/graphhopper · GitHub

You can use the roads vehicle with the transportation_mode option you mention plus the car_access and car_average_speed encoded values inside a custom model to achieve what you need (I think).

I followed the issue you attached, and there it says that the EncodedValue “bus” or “psv” has to be used in the custom model like this:
“priority”: [
“if”: “car_access == false && bus != YES || max_height < 4 || max_width < 3 || max_weight < 20”,
“multiply_by”: 0
To be able to use the bus/psv in the custom model as shown above, I tried to add it in the encoded values:
“graph.encoded_values”: “max_width,max_height,max_weight, bus”

but unfortunately I get the following error when parsing the config:
DefaultEncodedValueFactory cannot find EncodedValue bus

Is the implementation for the encoded values for bus and psv is available in the latest graphhopper-core version Or I have to implement it myself?

As described in the pull request: at the moment you have to develop this psv or bus encoded value on your own.

I have implemented ecnoding values for bus and psv, like hgv which is already available in the graphhopper core. But I noticed that the turn restrictions are ignored at all, even when using “vehicle”: “roads” with “transportation_mode”:“HGV,car”.
Below is my config which I am using to initiate the graphhopper:


name=bus_roads|vehicle=roads|weighting=custom|turnCosts=false|hints={custom_model=distanceInfluence=90.0|headingPenalty=300.0|speedStatements=[{“if”: “car_access && hgv == YES”, “limit_to”: car_average_speed * 0.9}, {“else”: “null”, “limit_to”: 20}]|priorityStatements=[{“if”: “car_access == false && hgv != YES || max_width < 3 || max_height < 4”, “multiply_by”: 0}]|areas=[], transportation_mode=HGV,car, custom_model_file=bus_roads.json}




graph.encoded_values: max_width,max_height,max_weight,bus,psv,hgv

datareader.file: D:\init\Workspace\gis_routing2_tenants_\gis_routing2\data\streets\hgv_test.osm


graph.location: tenants\gis_routing2\data\streets\graph-cache

graph.vehicles: roads|transportation_mode=HGV,car|turn_costs=true

since I am not allowed to set turn_costs=true in the my profile directly when using vehicle=roads, so that’s why I set in the graph.vehicles
But unfortunately all turn restrictions are not ignored. So is the case when using transportation_mode=BUS,car & transportation_mode=PSV,car

Is this issue already known, and am I missing something here?
I just want to consider all the turn restrictions except those which have an exception for psv, bus or hgv.

Additionally to the turn_costs parameter in the profile section can you try to set the turn_costs in the roads vehicle too, like:

graph.vehicles: roads|turn_costs=true|transportation_mode=HGV,car|turn_costs=true

I think it is a bug that as soon as you specify the graph.vehicles option you overwrite the turn_costs setting with false if you do not specify it.