Busway Support

If I make a bus profile, how can I get the bus to use the busway tagged highways? For example, this one Way: ‪Bus Lane‬ (‪1134794367‬) | OpenStreetMap

From what I can see reading the code, it doesn’t seem like road_class supports busway at the moment?

Yes, but you could add it of course. You’ll also need to add it to CarAccessParser.java if you like to use car_access for your bus profile.

Currently the recommended way for bus support is to use bus_access (which uses the ModeAccessParser). See bus access by karussell · Pull Request #2913 · graphhopper/graphhopper · GitHub

1 Like

in the PR you made @karussell does that ingest ways that have the busway tag? If I want the bus to use ways tagged with busway, do I need to edit to the code as @easbar suggested?

if I want to add the busway tag, but I don’t want to allow the default car profile to route on busways, can I accomplish this without adding to CarAccessParser? If I don’t add to that, but add the tag into the bus profile like this

    { "if": "bus_access && (road_class == BUSWAY || road_class == MOTORWAY || road_class == TRUNK || road_class == PRIMARY || road_class == SECONDARY || road_class == TERTIARY || road_class == UNCLASSIFIED || road_class == LIVING_STREET || road_class == RESIDENTIAL || road_class == SERVICE || road_class == ROAD)",
      "multiply_by": "1"
    },

will that work?

I made a PR which seems to work. I’m not totally sure where I should write unit tests / how to unit test this – I’m assuming I need a unit test for the bus profile and one for the car profile, and I need to make sure the routing works correctly for each profile. Is there a code pointer for an example unit test I can pattern match?