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.
- πΊοΈ 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
- πΊοΈ 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
- 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 librarypython-dotenv- Environment variable managementgoogle-generativeai- Gemini AI integration
Before running this project, you'll need to obtain API keys from:
-
TomTom API:
- Sign up at TomTom Developer Portal
- Get your API key for Routing and Geocoding services
-
OpenWeather API:
- Register at OpenWeather
- Get your free API key
-
Google Gemini AI (Optional but recommended):
- Access Google AI Studio
- Generate your Gemini API key
git clone https://github.com/hari7261/Smart-Routing-Moudle-2.git
cd Smart-Routing-Moudle-2pip install -r requirements.txtcd module1
pip install -r requirements.txt
cd ..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_hereNote: 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
python app.pyThen open your browser and navigate to: http://localhost:5000
How to use:
- Enter your starting location (city name or coordinates)
- Enter your destination (city name or coordinates)
- Click "Analyze Route"
- View comprehensive route details, weather conditions, and AI-powered suggestions
cd module1
python app.pyThen open your browser and navigate to: http://localhost:5000
How to use:
- Enter start and end locations (addresses or city names)
- Select route type (fastest, shortest, eco, or thrilling)
- Choose whether to include real-time traffic
- Click "Calculate Route"
- View the route on the interactive map with turn-by-turn instructions
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
Returns the main web interface
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 current weather for specific coordinates
Returns the navigation interface
Calculates a route with specified parameters
Request Body:
{
"start": "London",
"end": "Paris",
"routeType": "fastest",
"traffic": "true"
}-
Route Analysis
- Calculates distance and estimated travel time
- Identifies waypoints along the route
- Provides traffic delay information
-
Weather Integration
- Real-time weather at route waypoints
- Temperature, conditions, rain, and wind speed
- Weather-aware driving suggestions
-
AI Suggestions
- Recommended driving speed based on route and weather
- Fuel-efficient throttle advice
- Terrain-specific safety tips
- Personalized comfort recommendations
-
Multiple Route Types
- Fastest: Minimize travel time
- Shortest: Minimize distance
- Eco: Optimize for fuel efficiency
- Thrilling: For scenic or exciting routes
-
Interactive Mapping
- Visual route display on Leaflet map
- Start/end location markers
- Route polyline overlay
- Zoom and pan controls
-
Vehicle Customization
- Configure max speed, weight, dimensions
- Commercial vs. personal vehicle settings
- Optimized routing based on vehicle specs
Located in app.py:
VEHICLE_PROFILE = {
"fuel_type": "gasoline", # or "diesel", "electric"
"weight_kg": 1500, # Vehicle weight
"max_power_kw": 120 # Maximum power
}Customizable via the web interface:
- Route type selection
- Traffic enable/disable
- Vehicle specifications
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/YourFeature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/YourFeature - Open a Pull Request
- 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)
This project is open source and available under the MIT License.
Hari
- GitHub: @hari7261
- TomTom for their excellent routing and mapping APIs
- OpenWeather for weather data integration
- Google for Gemini AI capabilities
- Leaflet.js for interactive mapping
For issues, questions, or contributions, please:
- Open an issue on GitHub
- Submit a pull request
- Contact the repository maintainer
Happy Routing! ππ¨