4. Vehicle trip details
Takes a
vehicle_id
as input and returns route details of the current trip along with the live location of the vehicle.
Sample request
curl 'https://bmtcmobileapi.karnataka.gov.in/WebAPI/VehicleTripDetails_v2' \
-H 'Content-Type: application/json' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36' \
--data-raw '{"vehicleId":21670}'
Sample response
{
"RouteDetails": [
{
"rowid": 1,
"tripid": 68043555,
"routeno": "210-N",
"routename": "KBS-UTH",
"busno": "KA57F0614",
"tripstatus": "Running",
"tripstatusid": "1",
"sourcestation": "Kempegowda Bus Station",
"destinationstation": "Uttarahalli Bus Stand",
"servicetype": "Non AC/Ordinary",
"webservicetype": "Non-AC",
"servicetypeid": 72,
"lastupdatedat": "17-08-2025 12:33:18",
"stationname": "Uttarahalli Bus Stand",
"stationid": 22569,
"actual_arrivaltime": null,
"etastatus": "12:41",
"etastatusmapview": "12:41",
"latitude": 12.90535,
"longitude": 77.54327,
"currentstop": "",
"laststop": "Gowdanapalya (Towards Uttarahalli)",
"weblaststop": "Gowdanapalya",
"nextstop": "Chikkallasandra Aralimara (Towards Uttarahalli)",
"currlatitude": 12.911503,
"currlongitude": 77.555923,
"sch_arrivaltime": "12:48",
"sch_departuretime": "12:48",
"eta": "12:41",
"actual_arrivaltime1": null,
"actual_departudetime": null,
"tripstarttime": "11:50",
"tripendtime": "12:55",
"routeid": 3796,
"vehicleid": 21670,
"responsecode": 200,
"lastreceiveddatetimeflag": 1,
"srno": 1584405201,
"tripposition": 1,
"stopstatus": 1,
"stopstatus_distance": 1.53,
"lastetaupdated": "2025-08-17T12:41:00",
"minstopstatus_distance": 0.38
}
],
"LiveLocation": [
{
"latitude": 12.911503,
"longitude": 77.555923,
"location": "Gowdanapalya (Towards Kadirenahalli)",
"lastrefreshon": "17-08-2025 12:33:18",
"nextstop": "Chikkallasandra Aralimara (Towards Uttarahalli)",
"previousstop": "Prarthana School (Towards Uttarahalli)",
"vehicleid": 21670,
"vehiclenumber": "KA57F0614",
"routeno": "210-N",
"servicetypeid": 72,
"servicetype": "Non AC/Ordinary",
"heading": 241.00,
"responsecode": 200,
"trip_status": 1,
"lastreceiveddatetimeflag": 1
}
],
"Message": "Success",
"Issuccess": true,
"exception": null,
"RowCount": 29,
"responsecode": 200
}
Data Issues
Issue 1. Vehicle is assigned to more than one route
Vehicles on some occassions are assigned to more than one route. Ex: Vehicle KA57F5808
is assigned to two routes, routeno = 210-NA
and routeno = D33-PPLO
.
"LiveLocation": [
{
"latitude": 12.909809,
"longitude": 77.536422,
"location": "Depot-33 Poornapragna layout (Towards Depot-33 (Poornapragna layout))",
"lastrefreshon": "17-09-2025 23:19:34",
"nextstop": null,
"previousstop": "Arehalli (Towards Kengeri)",
"vehicleid": 27211,
"vehiclenumber": "KA57F5808",
"routeno": "210-NA",
"servicetypeid": 72,
"servicetype": "Non AC/Ordinary",
"heading": 210.18,
"responsecode": 200,
"trip_status": 1,
"lastreceiveddatetimeflag": 1
},
{
"latitude": 12.909809,
"longitude": 77.536422,
"location": "Depot-33 Poornapragna layout (Towards Depot-33 (Poornapragna layout))",
"lastrefreshon": "17-09-2025 23:19:34",
"nextstop": null,
"previousstop": "Arehalli (Towards Kengeri)",
"vehicleid": 27211,
"vehiclenumber": "KA57F5808",
"routeno": "D33-PPLO",
"servicetypeid": 72,
"servicetype": "Non AC/Ordinary",
"heading": 210.18,
"responsecode": 200,
"trip_status": 1,
"lastreceiveddatetimeflag": 1
}
]
Issue 2. Live location is missing
Live location was empty for about 2.5%
of vehicles (185
out of 7,247
vehicles) when run on 2025-09-17
. Ex: Vehicle ID 28622
with registration number KA01AR4181
.
{
"RouteDetails": [],
"LiveLocation": [],
"Message": "No Records Found",
"Issuccess": true,
"exception": null,
"RowCount": 0,
"responsecode": 200
}
Fetch
fetch_vehicle_trip_details
fetch_vehicle_trip_details (vehicle_id:int, sleep_duration:float=0.1)
Fetch trip details for a given vehicle ID from the BMTC API.
Extract
Dataset 1. Live Location
extract_live_locations
extract_live_locations (trip_details)
Extract live location from trip details.
collect_live_locations
collect_live_locations (directory:pathlib.Path)
Extract live location for all trip details in a directory.
Dataset 2. Route Details
extract_route_detail
extract_route_detail (trip_detail)
Task
task_fetch_vehicle_trip_details
task_fetch_vehicle_trip_details (data_directory:pathlib.Path)