Get the type of vehicle when querying public transport itinerary

Hello,
For now, in the result, I can only see "type": "walk" or "type": "pt" for each leg. See a more complete example of API response below.

Example
{
    "hints": {...},
    "info": {...},
    "paths": [
        ...
        {
            "distance": 812.786,
            "weight": 0.0,
            "time": 3213055,
            "transfers": 0,
            "points_encoded": false,
            "bbox": [...],
            "points": {...},
            "instructions": [...],
            "legs": [
                {
                    "type": "walk",
                    "departure_location": "Walk",
                    "geometry": {...},
                    "distance": 295.91533138687646,
                    "instructions": [...],
                    "details": {},
                    "departure_time": "2021-11-22T04:26:26.945+0000",
                    "arrival_time": "2021-11-22T04:30:00.000+0000"
                },
                {
                    "type": "pt",
                    "departure_location": "PONT ST-MICHEL",
                    "geometry": {...},
                    "distance": 0.0,
                    "feed_id": "gtfs_15",
                    "is_in_same_vehicle_as_previous": false,
                    "trip_headsign": "EXPRESS BOURGOIN-VILLEFONTAINE-LYON null",
                    "travel_time": 2520000,
                    "stops": [...],
                    "trip_id": "CG38:X0500|1:90800",
                    "route_id": "CG38:X05",
                    "departure_time": "2021-11-22T04:30:00.000+0000",
                    "arrival_time": "2021-11-22T05:12:00.000+0000"
                },
                ...
            ],
            "details": {},
            "ascend": 0.0,
            "descend": 0.0,
            "snapped_waypoints": {...}
        },
        ...
    ]
}

GTFS files knows more about it: each line has a route_type field, which is an int depending on the type of vehicle (bus, tram, train…). It is used by Google Map at least to show icons for each leg.
Is this field used in GraphHopper?
Is there any way to get the type of vehicle for each leg in a API response for a query with the pt profile?
Thanks!
Aina

I made a PR to add the route type in the API response.

Feel free to contribute.

Powered by Discourse