rmpca - Route Optimization TUI
A powerful Terminal User Interface (TUI) for route optimization using the Chinese Postman Problem (CPP) algorithm. Extract road networks from Overture Maps or OpenStreetMap, compile them into efficient binary formats, and optimize routes with turn penalties and depot constraints.
Features
- πΊοΈ Data Extraction: Extract road networks from Overture Maps S3 (Parquet) or OpenStreetMap PBF files
- π§ Binary Compilation: Convert GeoJSON to optimized
.rmpbinary format with CRC32 integrity checking - π Route Optimization: Solve the Chinese Postman Problem with:
- Eulerian circuit finding (Hierholzer's algorithm)
- Turn penalties (left, right, u-turn)
- Depot location support
- Oneway street handling (ignore/respect/reverse modes)
- Efficiency metrics and turn statistics
- π₯οΈ Interactive TUI: Beautiful terminal interface built with
ratatui - π Cached Maps Browser: Automatically scans for compiled
.rmpfiles - β‘ Performance: Concurrent S3 file processing, efficient graph algorithms
Installation
From crates.io
From source
Quick Start
Launch the TUI
Command-line extraction (alternative)
# Extract from Overture Maps
# Extract from OSM PBF file
Usage
1. Extract Road Network
- Navigate to Extract Data view
- Press
bto set bounding box (format:min_lat,min_lon,max_lat,max_lon) - Press
Taborsto toggle between OSM and Overture data sources - For OSM: Press
pto set path to local.osm.pbffile - Press
Enterto start extraction - Output:
extract_YYYYMMDD_HHMMSS.geojson
2. Compile to Binary
- Navigate to Compile Map view
- Press
ito set input GeoJSON file path - Press
oto set output path (optional, auto-derived from input) - Press
Enterto compile - Output:
.rmpbinary file
3. Browse Cached Maps
- Navigate to Browse Cached Maps view
- View all
.rmpfiles in current directory - Use
ββto select a map - Press
Enterto use selected map for optimization
4. Optimize Route
- Navigate to Optimize Route view
- Press
cto set compiled map file (.rmp) or select from Browse view - Configure turn penalties:
l- Left turn penalty (default: 1.0)R- Right turn penalty (default: 0.0)u- U-turn penalty (default: 5.0)
- Press
dto set depot coordinates (optional) - Press
Enterto optimize - Output:
route_YYYYMMDD_HHMMSS.json
Binary Format (.rmp)
The .rmp format is a compact binary representation:
[4 bytes] Magic "RMP1"
[4 bytes] Node count (u32 LE)
[4 bytes] Edge count (u32 LE)
[N * 16] Nodes: lat(f64) + lon(f64)
[E * 17] Edges: from(u32) + to(u32) + weight_m(f64) + oneway(u8)
[4 bytes] CRC32 checksum
Keyboard Shortcuts
Global
q- Quit applicationEsc- Return to homeh/F1- Toggle helpββ- Navigate menusEnter- Select / confirm
View-specific
- Extract:
Tab/stoggle source,bset bbox,pset PBF path (OSM only) - Compile:
iinput file,ooutput file - Browse Maps:
ββnavigate,Enterselect - Optimize:
ccache file,l/R/upenalties,ddepot
Library Usage
use ;
// Extract from Overture Maps
let extract_req = ExtractRequest ;
let result = run_extract?;
// Extract from OSM PBF
let extract_req = ExtractRequest ;
let result = run_extract?;
// Compile to binary
let compile_req = CompileRequest ;
let result = run_compile?;
// Optimize route
let optimize_req = OptimizeRequest ;
let result = run_optimize?;
Algorithms
Chinese Postman Problem (CPP)
- Build graph from road network
- Find odd-degree vertices
- Minimum weight perfect matching (greedy nearest-neighbor)
- Add duplicate edges to make all vertices even-degree
- Find Eulerian circuit (Hierholzer's algorithm)
- Calculate efficiency metrics
Turn Classification
- Bearing-based turn detection
- Categories: straight (Β±45Β°), left/right (45-135Β°), u-turn (>135Β°)
Data Sources
Overture Maps
- Source: AWS S3 public bucket (
overturemaps-us-west-2) - Format: Parquet with WKB geometry
- Release: 2026-04-15.0
- No authentication required
- Status: β Fully functional
OpenStreetMap
- Format: PBF (Protocol Buffer Format)
- Source: Local
.osm.pbffiles (download from Geofabrik, BBBike, etc.) - Status: β Fully functional
Performance
- Concurrent S3 Processing: Up to 10 files in parallel
- Node Deduplication: 1-meter precision snapping
- Binary Format: ~90% compression vs GeoJSON
- Graph Algorithms: O(E log V) for matching, O(E) for Eulerian circuit
Requirements
- Rust 1.70+
- Internet connection (for Overture Maps extraction)
- Local OSM PBF file (for OpenStreetMap extraction)
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Acknowledgments
- Overture Maps Foundation for open road network data
- OpenStreetMap contributors for global map data
- ratatui for the excellent TUI framework
- Chinese Postman Problem algorithm based on classical graph theory
Roadmap
- v0.1.0: Overture extraction, OSM PBF extraction, cached maps browser, basic optimization, TUI
- v0.2.0: Async/threaded operations, comprehensive tests, performance optimizations
- v0.3.0: Multi-depot support, advanced features
- v0.4.0+: Time windows, capacity constraints
- v1.0.0: Stable API, backward compatibility guarantees
Support
- Documentation: docs.rs/v2rmp
- Issues: GitHub Issues
- Discussions: GitHub Discussions