0% found this document useful (0 votes)
11 views13 pages

Real-Time Cab Booking Simulation

Uploaded by

triptotrust
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views13 pages

Real-Time Cab Booking Simulation

Uploaded by

triptotrust
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Cab Booking System

Nearest Cab Allocation & Real-Time Visualization

Team Members

Honey Vedant Abhishek Tejas

(B24CM1030) (B24EE1073) (B24EE1046) (B24CS1018)


Problem Statement
How can we simulate a cab booking system using live map data?

• Show cabs placed realistically on nearby roads

• Identify the nearest cab using road-based distance

• Display shortest path from cab → pickup → drop

• Animate the cab movement on the real route


Solution Overview

A fully frontend-based cab booking simulation built using JavaScript and mapping APIs.

System Components:

• [Link] Map – interactive map with markers

• OSRM APIs – road-based distance matrix + routing

• Overpass API – spawn cabs on real roads

• Custom JS Engine – animation & trip updates

Key Features:

• Nearest cab selection using OSRM distance matrix

• Real-road routing using OSRM Route API

• Smooth cab movement along GeoJSON path

Live trip card showing ETA, fare, distance, duration


Optional drop location routing
Data Structures Used
Our system uses simple but effective data structures to manage cab information and optimize nearest cab selection:

1. Arrays (cabCoords)

▸ Store cab locations and information


Used for storing latitude, longitude, and cab status for all available cabs
Why Used :
Simple, fast to iterate
Perfect for small to medium number of cabs
Works well with OSRM matrix indexing

2. Objects (Cab State Management)

▸ Travel time calculations between locations


Store cab ID, location, availability status (available/booked), and other metadata
Why used:
Groups related trip data in one place
Easy to update UI directly from fields
Enhances code readability & maintainability

3. GeoJSON Structure (Route Data)


What it stores: OSRM route geometry (list of coordinates)
Why used:
Standard format for map polylines
Directly supported by [Link]
Ideal for animation and route drawing
4. OSRM Distance Matrix (Table API)
What it stores: cab → pickup travel distances
Why used:
Provides road-based distance, not straight line
Makes nearest cab selection realistic
Faster than calculating routes for each cab

5. Linear Search Algorithm (O(n))


What it does: loops through all cabs to find minimum distance
Why used:
Perfect for 1–30 cabs (your project scale)
No overhead of complex indexing structures
Works directly with OSRM distance matrix

**6. Haversine Distance Formula


Purpose:
Used as a fallback when Overpass road data fails
Computes straight-line distance between latitude/longitude points
Why:
Lightweight and fast
Great for estimating distances when route API isn’t available
Tools & Technologies

Frontend

▪ HTML5 - Markup and structure

▪ CSS3 - Styling and responsive design

▪ JavaScript - Client-side logic and interactions

▪ [Link] - Interactive map library for visualization

APIs/ Services:

OSRM — routing & distance matrix


Overpass API — real-road cab spawning
Leaflet Routing - Route visualization on maps
Honey
Cab Management & UI Styling

Files Worked On:

• cab_management.cpp & cab_management.h

• [Link]

• [Link] (partial contribution)

Key Contributions:

• Implemented core cab management logic for storing and tracking cab information

• Developed nearest cab selection algorithm using OSRM API for travel time calculations

• Created responsive CSS styling for the web interface

• Implemented cab status management (available, booked, in-transit)

Impact:

• Ensures clear UI/UX with accurate real-time trip data


Improves usability and visual clarity
Vedant
Frontend & Map Integration

Files Worked On:

• [Link] (main contributor)

• [Link] (partial)

Key Contributions:

• Implemented core frontend functionality and user interactions

• Integrated [Link] library for interactive map display and visualization

• Built nearest cab algorithm

• Created route visualization with waypoint markers and optimal path display

• Handled map interactions (zoom, pan, click-to-select locations)

• Managed real-time DOM updates for cab positions and booking status

Impact:

• Enables realistic routing, movement, and simulation


Provides core functionality of the entire project
Abhishek
Routing Logic & Map Processing

Files Worked On:

• real_map_logic.cpp & real_map_logic.h

Key Contributions:

• Implemented map processing and routing algorithms in C++

• Created graph-based representation of road networks

• Implemented pathfinding logic for route calculation

• Managed cab state transitions (available, booked, in-transit, completed)

• Handled geographic coordinate processing and location updates

• Ensured accuracy of distance and travel time calculations

• Integrated with OSRM for real-world routing data

Impact:

• Provides the reliable, accurate foundation for the entire system

• Ensures routing calculations and cab state management are correct and consistent
Tejas
Application Integration & Lifecycle Management

Files Worked On:

• [Link]
• [Link] (control flow integration)

Key Contributions:

• Implemented the main application entry point and initialization

• Integrated all C++ components (cab management, routing logic)


• Managed overall flow of pickup → cab → drop
• Helped define the initial problem statement and project scope

• Kept the application logic simple and maintainable

Impact:

• Ensures all components work together seamlessly

• Creates a cohesive system that is easy to understand and use


Demo: Cab Allocation and path finder visualization on map
Live demonstration of user requesting a cab and system finding the nearest available cab
Conclusion

Key Achievements:

Real-road based routing using OSRM


Accurate nearest cab selection
Real-time animated cab movement
Interactive map-based UI
Dynamic trip detail updates

Technical Learnings:

Routing APIs (OSRM)


Overpass API for real-road geodata
[Link] map & GeoJSON handling
Animation engine using requestAnimationFrame
State management in JavaScript

Future Optimization Opportunities:

Traffic-aware routing
Spatial indexing for faster cab search
Multiple cabs competing for rides
User authentication & ride history
Real backend with live data

Common questions

Powered by AI

Mapping APIs like OSRM and Overpass are integral to the system's functionality, providing essential routing and distance data to simulate realistic cab journeys. They allow the system to project real-world geo-spatial data onto interactive maps, guiding the simulation with accurate road information, effectively mapping cab locations, and ensuring smooth transitions and updates throughout the booking process .

The system integrates several key technologies to enhance user interaction: Leaflet.js for interactive mapping, JavaScript for client-side logic and visualization, and OSRM for route calculations. These technologies work together to create a dynamic UI where users can select locations, view real-time cab movements, and receive instant updates, thus offering a comprehensive simulation experience .

A frontend-based simulation offers lower complexity and overhead compared to full-stack implementations. It allows real-time updates and interactions directly in the user's browser, making the system more responsive and easier to manage. The integration with JavaScript and mapping APIs provides a seamless user experience with interactive elements like zooming and dynamic updates without the need for continuous server communication .

Proposed future optimizations include implementing traffic-aware routing to consider current road conditions, utilizing spatial indexing to improve the efficiency of cab searches, introducing multiple cabs for ride competition, adding user authentication and ride history, and potentially incorporating a real backend with live data to provide more accurate and dynamic responses .

Real-time data visualization is optimized through the use of Leaflet.js for map interactivity and GeoJSON for path representation, ensuring efficient rendering of the map and animations. The system utilizes lightweight data structures and efficient algorithms like the OSRM Distance Matrix to maintain fluid updates. JavaScript's requestAnimationFrame helps in smoothly animating cab movements along routes, enhancing the user experience without compromising performance .

GeoJSON is a standard format for representing geographical features and their attributes. It is used in the system for storing OSRM route geometry as lists of coordinates. This format is directly supported by Leaflet.js, enabling smooth and accurate visualization of cab movement along predefined paths, thus enhancing the realism of the animation .

The system uses the Haversine Distance Formula as a fallback when road data from the Overpass API is unavailable. This formula computes the straight-line distance between latitude and longitude points, providing a quick and efficient method to estimate distances without the detailed road data typically necessary for routing .

The OSRM API provides both the routing and distance matrix services necessary for realistic cab route simulation. It helps calculate accurate travel routes and times between cab locations and pickup/drop locations by using real road data rather than straight-line calculations, ensuring the cab follows actual navigable roads .

The linear search algorithm's O(n) complexity becomes less efficient as the number of cabs increases, potentially causing delays in larger datasets. The system mitigates this by focusing on a scale of 1-30 cabs, where linear search is manageable due to its simplicity and absence of complex indexing overhead. For future scalability, more efficient algorithms might be implemented .

The system uses the OSRM Distance Matrix to calculate road-based distances between cabs and the pickup point, ensuring a realistic assessment of proximity rather than relying on straight-line distance alone. It loops through all available cabs using a linear search algorithm, which is efficient given the project scale of 1-30 cabs, to identify the minimum distance .

You might also like