Skip to content

smart routing and navigation system that combines intelligent route planning with real-time weather data and AI-powered driving suggestions.

Notifications You must be signed in to change notification settings

hari7261/Smart-Routing-Moudle-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš— Smart Routing Module 2

A comprehensive smart routing and navigation system that combines intelligent route planning with real-time weather data and AI-powered driving suggestions. This project provides two different modules for navigation and smart driving assistance.

✨ Features

Main Smart Driving Assistant (Root Module)

  • πŸ—ΊοΈ Intelligent Route Planning: Calculate optimal routes between cities or coordinates using TomTom Routing API
  • 🌦️ Real-Time Weather Integration: Get current weather conditions along your route using OpenWeather API
  • πŸ€– AI-Powered Suggestions: Receive personalized driving recommendations using Google Gemini AI
  • πŸ“Š Detailed Route Analytics: Distance, duration, traffic delays, and waypoint information
  • πŸ’‘ Smart Driving Tips: Speed recommendations, throttle advice, terrain tips, and safety messages
  • 🎨 Clean Web Interface: User-friendly interface for route analysis

TomTom Navigation Module (module1)

  • πŸ—ΊοΈ Interactive Map Navigation: Visual route display using Leaflet and TomTom Maps
  • πŸ“ Geocoding Support: Enter city names or addresses - automatic conversion to coordinates
  • 🚦 Multiple Route Types: Choose from fastest, shortest, eco, or thrilling routes
  • πŸš— Traffic-Aware Routing: Real-time traffic integration for accurate ETA
  • πŸ“‹ Turn-by-Turn Instructions: Detailed navigation instructions with distance markers
  • 🎯 Custom Vehicle Parameters: Configure vehicle specifications for optimized routing

πŸ› οΈ Tech Stack

  • Backend: Flask (Python web framework)
  • APIs:
    • TomTom Routing & Geocoding API
    • OpenWeather API
    • Google Gemini AI API
  • Frontend:
    • HTML5, CSS3, JavaScript
    • Leaflet.js (Interactive maps)
    • TomTom Maps SDK
  • Dependencies:
    • requests - HTTP library
    • python-dotenv - Environment variable management
    • google-generativeai - Gemini AI integration

πŸ“‹ Prerequisites

Before running this project, you'll need to obtain API keys from:

  1. TomTom API:

  2. OpenWeather API:

  3. Google Gemini AI (Optional but recommended):

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/hari7261/Smart-Routing-Moudle-2.git
cd Smart-Routing-Moudle-2

2. Install Dependencies

For Main Module (Smart Driving Assistant):

pip install -r requirements.txt

For Module 1 (TomTom Navigation):

cd module1
pip install -r requirements.txt
cd ..

3. Configure Environment Variables

Create a .env file in the root directory with your API keys:

TOMTOM_API_KEY=your_tomtom_api_key_here
OPENWEATHER_API_KEY=your_openweather_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

Note: The project includes fallback mechanisms, so if some API keys are missing:

  • TomTom: Returns mock data
  • OpenWeather: Returns default weather conditions
  • Gemini AI: Returns basic driving suggestions

πŸ“– Usage

Running the Main Smart Driving Assistant

python app.py

Then open your browser and navigate to: http://localhost:5000

How to use:

  1. Enter your starting location (city name or coordinates)
  2. Enter your destination (city name or coordinates)
  3. Click "Analyze Route"
  4. View comprehensive route details, weather conditions, and AI-powered suggestions

Running TomTom Navigation Module

cd module1
python app.py

Then open your browser and navigate to: http://localhost:5000

How to use:

  1. Enter start and end locations (addresses or city names)
  2. Select route type (fastest, shortest, eco, or thrilling)
  3. Choose whether to include real-time traffic
  4. Click "Calculate Route"
  5. View the route on the interactive map with turn-by-turn instructions

πŸ“ Project Structure

Smart-Routing-Moudle-2/
β”œβ”€β”€ app.py                      # Main application (Smart Driving Assistant)
β”œβ”€β”€ requirements.txt            # Main dependencies
β”œβ”€β”€ .env                        # Environment variables (create this)
β”œβ”€β”€ .gitignore                  # Git ignore rules
β”‚
β”œβ”€β”€ utils/                      # Utility modules
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ tomtom.py              # TomTom API integration
β”‚   β”œβ”€β”€ weather.py             # OpenWeather API integration
β”‚   └── gemini.py              # Google Gemini AI integration
β”‚
β”œβ”€β”€ templates/                  # HTML templates for main module
β”‚   └── index.html             # Main interface
β”‚
β”œβ”€β”€ static/                     # Static assets for main module
β”‚   └── style.css              # Styling
β”‚
└── module1/                    # TomTom Navigation Module
    β”œβ”€β”€ app.py                 # Navigation app
    β”œβ”€β”€ requirements.txt       # Module-specific dependencies
    β”œβ”€β”€ templates/
    β”‚   └── index.html        # Navigation interface
    └── static/
        └── style.css         # Navigation styling

🌐 API Endpoints

Main Module (Smart Driving Assistant)

GET /

Returns the main web interface

POST /api/analyze_route

Analyzes a route and returns comprehensive data

Request Body:

{
  "start": "New York",
  "end": "Boston"
}

Response:

{
  "route": {
    "distance_km": 215.5,
    "duration_min": 195.2,
    "waypoints": [...],
    "traffic_delay_sec": 300
  },
  "weather": {
    "temp_c": 18.5,
    "conditions": "Clear",
    "rain_mm": 0,
    "wind_speed_kmh": 15.2
  },
  "suggestions": {
    "recommended_speed_kmh": 85,
    "throttle_advice": "...",
    "terrain_advice": "...",
    "safety_message": "...",
    "extra_tips": "..."
  }
}

GET /api/current_weather?lat={lat}&lon={lon}

Get current weather for specific coordinates

Module 1 (TomTom Navigation)

GET /

Returns the navigation interface

POST /calculate_route

Calculates a route with specified parameters

Request Body:

{
  "start": "London",
  "end": "Paris",
  "routeType": "fastest",
  "traffic": "true"
}

🎨 Features in Detail

Smart Driving Assistant Features

  1. Route Analysis

    • Calculates distance and estimated travel time
    • Identifies waypoints along the route
    • Provides traffic delay information
  2. Weather Integration

    • Real-time weather at route waypoints
    • Temperature, conditions, rain, and wind speed
    • Weather-aware driving suggestions
  3. AI Suggestions

    • Recommended driving speed based on route and weather
    • Fuel-efficient throttle advice
    • Terrain-specific safety tips
    • Personalized comfort recommendations

TomTom Navigation Features

  1. Multiple Route Types

    • Fastest: Minimize travel time
    • Shortest: Minimize distance
    • Eco: Optimize for fuel efficiency
    • Thrilling: For scenic or exciting routes
  2. Interactive Mapping

    • Visual route display on Leaflet map
    • Start/end location markers
    • Route polyline overlay
    • Zoom and pan controls
  3. Vehicle Customization

    • Configure max speed, weight, dimensions
    • Commercial vs. personal vehicle settings
    • Optimized routing based on vehicle specs

πŸ”§ Configuration Options

Vehicle Profile (Main Module)

Located in app.py:

VEHICLE_PROFILE = {
    "fuel_type": "gasoline",    # or "diesel", "electric"
    "weight_kg": 1500,          # Vehicle weight
    "max_power_kw": 120         # Maximum power
}

Route Parameters (Module 1)

Customizable via the web interface:

  • Route type selection
  • Traffic enable/disable
  • Vehicle specifications

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/YourFeature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/YourFeature
  5. Open a Pull Request

πŸ› Known Issues & Limitations

  • API rate limits may apply based on your subscription tier
  • Geocoding works best with well-known city names
  • Mock data is returned if API keys are not configured
  • Gemini AI may occasionally return non-JSON responses (handled with fallbacks)

πŸ“ License

This project is open source and available under the MIT License.

πŸ‘¨β€πŸ’» Author

Hari

πŸ™ Acknowledgments

  • TomTom for their excellent routing and mapping APIs
  • OpenWeather for weather data integration
  • Google for Gemini AI capabilities
  • Leaflet.js for interactive mapping

πŸ“ž Support

For issues, questions, or contributions, please:

  • Open an issue on GitHub
  • Submit a pull request
  • Contact the repository maintainer

Happy Routing! πŸš—πŸ’¨

About

smart routing and navigation system that combines intelligent route planning with real-time weather data and AI-powered driving suggestions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •