Overview
The route planner analyzes multiple transport combinations and returns up to 3 optimal routes categorized as:- Fastest Route: Minimizes total travel time including wait time
- Least Local Transport: Minimizes use of CNG/rickshaw to reduce costs
Planning a Route
Use the/api/routes endpoint to plan a route between any two locations.
1
Select your origin location
Choose from the 19 available nodes in the network. Each node represents a bus stop, intersection, or destination in Sylhet.Response includes node details:
2
Request route options
Call the route planning endpoint with your origin, destination, and desired departure time.
The
time parameter should be in 24-hour format (HH:MM). If omitted, it defaults to the current time.3
Review route options
The API returns multiple route options, each with detailed leg information.
Route Types
The planner considers multiple routing strategies:Direct Bus Routes
A single bus takes you from origin to destination without transfers.Bus + Local Hybrid
Take the bus as far as possible, then use local transport (CNG/rickshaw) for the remaining distance.Transfer Routes
Switch between two buses at a common stop.Transfer routes are only suggested if the wait time at the transfer point is 15 minutes or less.
Local-Only Fallback
When no bus routes are available or you’ve missed the bus, the planner provides a local-only option.Understanding Route Legs
Each route consists of one or more legs representing a segment of the journey.Bus Leg Fields
Bus Leg Fields
Local Transport Leg Fields
Local Transport Leg Fields
Using Current Route Context
When planning a route while already on a bus, provide thecurrentRoute parameter to get updated options.
Map Visualization
Rendering Route Legs
For each leg in the route:- Bus legs: Draw a polyline connecting the stops along the route
- Local legs: Use Google Maps Directions API to get turn-by-turn directions and polylines
- Walking legs: Show straight-line or walking path between points
Example: Flutter Map Integration
Best Practices
Optimizing for different scenarios
Optimizing for different scenarios
- Morning commute: Request routes 30 minutes before you need to arrive to account for wait times
- Returning from campus: Use “from_campus” direction buses which have different schedules
- Late arrivals: If you miss the bus, the local-only fallback ensures you can still get to campus
- Cost-conscious: Look for the “Least Local Transport” option to minimize expenses
Handling API responses
Handling API responses
- Always check if
optionsarray is empty - this means no routes are available - Sort options by
totalTimeMinortotalCostbased on user preference - Show
categorybadges (“Fastest”, “Least Local”) in the UI - Display
transferscount prominently - students often prefer direct routes
Related Endpoints
See the related documentation:- Viewing Schedules - Check bus departure times
- Saving Favorites - Save frequently used routes
- Authentication - Secure your API requests