orutego is a modern web application for calculating travel distance (km) and travel time (Hours-Minutes & Decimal Hours) between origin and destination addresses using Google Maps Platform.
- 📍 Address Input: Form inputs with auto-complete for origin and destination addresses
- 🔄 Address Swap: Button to swap origin and destination addresses
- 🚗 Travel Modes: Options for driving, walking, cycling, and transit
- 📊 Calculation Results: Coordinates, distance (km), and travel time (HH:MM & decimal)
- 🗺️ Interactive Map: Route visualization with markers and polylines
- 💾 Session Management: API key storage and result caching
- 📋 Copy to Clipboard: Easy copying of coordinate data in CSV format
- 📦 Mass Route: Bulk route calculation from multiple origins to a single destination with CSV export
- Python 3.7+ installed
- Google Maps API Key with the following APIs enabled:
- Geocoding API
- Distance Matrix API
- Directions API
- Maps JavaScript API
-
Clone the repository:
git clone https://github.com/rusli3/orutego.git cd orutego -
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and go to:
http://localhost:5000
- Input API Key: Enter your Google Maps API Key and click "Save API Key"
- Enter Addresses: Input origin and destination addresses (with autocomplete feature)
- Select Mode: Choose travel mode (driving/walking/cycling/transit)
- Calculate: Click "Calculate Route" button
- View Results: Coordinates, distance, and time will be displayed
- View Map: Interactive map with route will appear below
- Switch Tab: Click the "Mass Route" tab at the top of the sidebar
- Enter Destination: Input a single destination address
- Input Origins: Enter multiple origin addresses (one per line) in the text area
- Select Mode: Choose travel mode (driving/walking/cycling/transit)
- Calculate: Click "Calculate Routes" to process all routes
- View Results: See coordinates, distance, and travel time for each origin
- Export: Click "Copy All (CSV)" to get a CSV-formatted list of results
The coordinate data is displayed in a raw comma-separated format without headers:
lat_origin,lng_origin,lat_destination,lng_destination,distance_km,HH:MM,decimal_hours
Example:
-0.026700,109.342100,-0.114200,109.406500,12.84,01:30,1.50
The mass route results are exported in CSV format with headers:
Lat_Origin,Lng_Origin,Lat_Destination,Lng_Destination,Distance_km,Duration_HHMM,Decimal_Hours,Status
-0.032100,109.345600,-0.114200,109.406500,12.84,01:30,1.50,OK- Flask: Web framework for Python
- Google Maps APIs: Geocoding, Distance Matrix, and Directions
- Session Management: API key and result caching
- Error Handling: Comprehensive validation and error messages
- Modern CSS: Responsive design with animations and gradients
- Vanilla JavaScript: Clean, modern ES6+ code
- Google Maps Integration: Interactive maps with real route rendering
- Local Storage: Client-side result persistence
GET /- Main application pagePOST /api/save-key- Save Google Maps API keyPOST /api/calculate- Calculate route distance and timePOST /api/mass-route- Calculate routes from multiple origins to single destination
- Compact Layout: Responsive design that adapts to different screen sizes
- Modern Design: Glass-morphism effects with gradient backgrounds
- Smooth Animations: CSS transitions and keyframe animations
- Loading States: Visual feedback during API calls
- Error Handling: User-friendly error messages
- API key stored temporarily in server session
- API key never written to logs or output
- Password input type for API key entry
- Results cached in server session
- Client-side persistence with localStorage
- Input validation before API calls
- Comprehensive validation for all inputs
- Informative error messages for API failures
- Network error handling with retry suggestions
orutego/
├── .env.example # Environment variables template
├── .gitignore # Git ignore file
├── LICENSE # MIT License
├── README.md # This file
├── CHANGELOG.md # Version history and changes
├── DEPLOYMENT.md # Production deployment guide
├── app.py # Flask backend application
├── utils.py # Utility functions for Google Maps API
├── requirements.txt # Python dependencies
├── style.css # Legacy CSS file
├── test_decimal_conversion.py # Test suite for decimal hours
├── templates/
│ └── index.html # Main HTML template
└── static/
├── styles.css # CSS styling and animations
└── script.js # JavaScript application logic
- Go to the Google Cloud Console
- Create a new project or select existing one
- Enable these APIs:
- Geocoding API
- Distance Matrix API
- Directions API
- Maps JavaScript API
- Create credentials (API Key)
- Restrict your API key (recommended for production)
- For HTTP referrers: Add your domain (e.g.,
localhost:5000/*for development) - For API restrictions: Select the 4 APIs listed above
- For HTTP referrers: Add your domain (e.g.,
- Chrome 70+
- Firefox 65+
- Safari 12+
- Edge 79+
This project is open source. Feel free to use and modify as needed.
- Fork the project
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request