|
Download README.md from 3hstack/Routeem: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/spaces/3hstack/Routeem/resolve/main/README.md
- Command line
-
hf download hf://spaces/3hstack/Routeem/README.md
-
curl -L -o README.md https://huggingface.co/spaces/3hstack/Routeem/resolve/main/README.md
2.44 kB
metadata
title: Route Em
emoji: 🗺️
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
license: mit
Route Em
Finds the shortest closed route that covers every road, both sides — the route you'd drive or walk to put a paper on every doorstep.
How to use it
- Drop your map screenshot in the left panel. It stays in your browser — it's never uploaded. It's a visual reference for matching the map.
- Type a ZIP code or address and hit Find. The map jumps there.
- Click "Draw box" and drag a rectangle around the neighborhood.
- Optional: shift-click to set where you start and end.
- Solve route.
You get the route drawn in travel order (blue → yellow), deadhead segments dashed red, plus total distance, deadhead miles, efficiency, and turn-by-turn directions.
Why it's optimal, not a guess
This is the Directed Chinese Postman Problem:
- Two-way street → two required passes (one per curb).
- One-way street → one required pass.
- Find the shortest closed walk covering every required pass.
Solved exactly:
- Compute each intersection's imbalance (
out_degree − in_degree). - Min-cost flow from deficit nodes to surplus nodes, cost = shortest-path distance. This yields the cheapest set of passes to repeat ("deadhead").
- Add those repeats — the graph is now Eulerian — and extract the Eulerian circuit.
That circuit is provably the shortest possible. The solver asserts full coverage before returning anything.
Notes
- Roads come from OpenStreetMap via Overpass. Coverage is only as good as OSM's data for your area — check for missing new streets.
- Areas are capped at 25 sq mi / 6,000 passes. A real paper route is well under 1 sq mi.
- Deadhead mileage is unavoidable, not a flaw — cul-de-sacs and dead ends force backtracking by definition.
- Time estimates use crude constants (12 mph driving, 2.5 mph walking, stops included).
- This Space calls the public Overpass and Nominatim APIs. On a shared IP they occasionally rate-limit; if a solve fails, wait a moment and retry.
Deploy your own
git clone https://huggingface.co/spaces/<you>/route-em
cd route-em
# copy app.py, Dockerfile, README.md in (deps are inlined in the Dockerfile)
git add . && git commit -m "Route Em" && git push
The Space builds itself from the Dockerfile. First build takes a few minutes (geopandas).