An interactive map navigation simulator using real OpenStreetMap data. Navigate through cities with keyboard controls or watch automated pathfinding algorithms in action.
- Load real street maps from OpenStreetMap
- Visualize road networks for any city
- Automatic data caching for faster loading
- Keyboard Control: Navigate with arrow keys (↑/←/→/↓)
- Smart Junction Detection: Automatically identifies available directions
- Zoom Inset: Detailed view of current intersection in corner
- Real-time Statistics: Track distance traveled and junctions visited
- Visual Feedback: Color-coded directions and path history
- Automatic navigation with command sequences (e.g., "left, right, right")
- Dead-end detection and automatic U-turn logic
- Road type filtering (highways, forest roads, residential streets)
┌──────────────────────────────────────────────┐
│ Main Map View │
│ │
│ [Interactive Navigation] │
│ │
│ ┌────────────────┐ │
│ │ Zoom Inset │ │
│ │ │ │
│ │ ┌─────────┐ │ │
│ │ │GERADEAUS│ │ │
│ │ └─────────┘ │ │
│ │ ● │ │
│ │ ← / → │ │
│ └────────────────┘ │
└──────────────────────────────────────────────┘
Controls: ↑=Forward ←=Left →=Right ↓=Back I=Info Q=Quit
- Python 3.8+
- pip
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/interactive-street-navigator.git cd interactive-street-navigator -
Install dependencies
pip install -r requirements.txt
-
Run the program
python src/main.py
- Start the program:
python src/main.py - Choose mode:
- [1] Static map view (Phase 1)
- [2] Interactive navigation (Phase 2)
| Key | Action |
|---|---|
↑ |
Drive straight |
← |
Turn left |
→ |
Turn right |
↓ |
U-turn / Go back |
I |
Show detailed information |
Q |
Quit |
Edit src/config.py to customize:
# City to load
CITY_NAME = "Solingen, Germany"
# Visualization
SHOW_ZOOM_INSET = True # Show/hide zoom inset
FIGURE_SIZE = (15, 15) # Map window size
# Colors
COLOR_NODES = "#FF0000" # Junctions
COLOR_EDGES = "#0066CC" # Streets
COLOR_BACKGROUND = "#F5F5F5" # Background
# Cache
CACHE_DATA = True # Enable/disable map cachinginteractive-street-navigator/
├── src/
│ ├── main.py # Entry point
│ ├── config.py # Configuration settings
│ ├── map_loader.py # OpenStreetMap data loader
│ ├── navigator.py # Navigation logic
│ ├── visualizer.py # Static map visualization
│ └── interactive_map.py # Interactive map with controls
├── data/ # Cached map data (auto-generated)
├── requirements.txt # Python dependencies
└── README.md # This file
- Uses
osmnxto download street data from OpenStreetMap - Converts data into a graph structure (nodes = junctions, edges = streets)
- Caches data locally for faster subsequent loads
- Navigator class: Manages current position and movement
- Direction calculation: Uses GPS coordinates to compute bearing angles
- Junction analysis: Identifies available routes (left/right/straight/back)
- Relative angles: Classifies directions relative to current heading
- Main map: Overview of entire city
- Zoom inset: Detailed view (200m radius) of current intersection
- Smart labeling: Labels stay within zoom window
- Line clipping: Dashed lines indicate roads extending beyond view
# Streets are modeled as a directed graph
# Nodes: Intersections with GPS coordinates
# Edges: Street segments with length, type, etc.
graph = ox.graph_from_place("Solingen, Germany", network_type="drive")# Compass bearing: 0° = North, 90° = East, 180° = South, 270° = West
# Relative angle = target_bearing - current_heading
if -45° <= relative_angle <= 45°: # Straight
elif 45° < relative_angle <= 135°: # Right
elif -135° <= relative_angle < -45°: # Left
else: # BackThis project was created to learn and practice:
- Python: OOP, matplotlib, event handling
- Geospatial data: Working with GPS coordinates and map APIs
- Graph algorithms: Navigation, pathfinding
- Real-time visualization: Interactive graphics
- Phase 1: Map loading and visualization
- Phase 2: Interactive navigation with keyboard controls
- Zoom inset for detailed intersection view
- Smart label placement and line clipping
- Phase 3: Automated navigation with command sequences
- Phase 4: Dead-end detection and recovery
- Phase 5: Road type filtering (highways, forest roads)
- Phase 6: Pathfinding algorithms (Dijkstra, A*)
- Future: C++ port for performance comparison
- osmnx: OpenStreetMap data loader
- networkx: Graph data structure
- matplotlib: Visualization and interactive graphics
- geopandas: Geospatial data processing
- numpy: Mathematical computations
This is a learning project, but suggestions and improvements are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- OpenStreetMap for providing free map data
- osmnx library by Geoff Boeing
- Built as a learning project to explore Python and navigation algorithms
Full city overview with current position marked.
Color-coded directions with clear labels:
- 🟢 Green = Straight
- 🔵 Blue = Left
- 🟠 Orange = Right
- ⚪ Gray = Back
Real-time tracking of:
- Distance traveled (km)
- Junctions visited
- Current GPS coordinates
- Available directions
Questions or feedback? Feel free to open an issue!
Built with ❤️ to learn Python and navigation algorithms