Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

kelwynOliveira/route-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Streamlit Google Maps API

🚗 Route Optimizer with Google Maps (by time)

  • Find the most time-efficient route between multiple locations using the Google Distance Matrix API and an optimization algorithm.
  • Supports driving, walking, biking, and public transport.

Streamlit app link: https://routes-maps.streamlit.app/


🖼️ Preview

Route Optimizer


🧠 Features

  • Add and edit a list of addresses dynamically
  • Select start and end points independently
  • Choose transportation mode (driving, walking, biking, public transport)
  • Optimize route using the Traveling Salesman Problem formulation with constraints
  • Generate a link to the optimized route directly on Google Maps
  • Display the route on an embedded map

⚙️ How to Run

1️⃣ Create a virtual environment (optional but recommended)

For macOS / Linux:

python3 -m venv .venv
source .venv/bin/activate

For Windows:

python -m venv .venv
.venv\Scripts\activate

2️⃣ Install dependencies

pip install -r requirements.txt

3️⃣ Run the app

streamlit run main.py

4️⃣ Stop the app

To deactivate the virtual environment when you're done:

deactivate

✨ How It Works

This app uses the Google Routes API to calculate travel times between addresses, then applies a Linear Programming model to find the shortest-duration route based on:

  • Start and end location
  • Selected travel mode (car, walk, bike, public transport)

It supports both circular (round-trip) and open (point-to-point) route planning.


📁 Project Structure

.
├── main.py         # Streamlit app
├── aux.py          # Route calculation and API integration
└── requirements.txt

📌 Notes

  • Ensure all addresses are valid and correctly formatted.
  • API responses may vary based on limits and usage quota.

About

A Streamlit app that finds the most time-efficient route between multiple addresses using the Google Maps API. Supports various transportation modes and generates a shareable Google Maps link with the optimized route.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages