2. Route Points

Takes route_id as input and returns geo-locations of the route to be taken in response. There isn’t an identifier for the bus stop in this dataset. Instead it’points are at regular distance along the route.

Sample request

curl -X POST 'https://bmtcmobileapi.karnataka.gov.in/WebAPI/RoutePoints' \
  -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' \
  -d '{"routeid":3796}'

Sample response

{
    "data": [
        {
            "latitude": "12.97751",
            "longitude": "77.57141",
            "responsecode": 200
        },
        {
            "latitude": "12.97749",
            "longitude": "77.57098",
            "responsecode": 200
        },
        {
            "latitude": "12.905319",
            "longitude": "77.543217",
            "responsecode": 200
        },
        {
            "latitude": "12.905319",
            "longitude": "77.543217",
            "responsecode": 200
        }
    ],
    "Message": "Success",
    "Issuccess": true,
    "exception": null,
    "RowCount": 560,
    "responsecode": 200
}

Functions


source

fetch_route_points

 fetch_route_points (route_id:str, sleep_duration:float=0.1)

Fetches geo-locations for a given BMTC route_id from the API.


source

get_route_id

 get_route_id (filepath:pathlib.Path)

The filepath has route_id at the end.


source

convert_route_to_geojson

 convert_route_to_geojson (route, properties)

Converts route into a geojson Feature.


source

task_fetch_route_points

 task_fetch_route_points (data_directory:pathlib.Path)