An intelligent fiber-optic pathfinding web application that calculates the shortest route between any two points on Earth using a hybrid graph of terrestrial and submarine cables.
The app dynamically fetches data from the ITU (International Telecommunication Union) Broadband Maps for land infrastructure and the Submarine Cable Map (SCM) for oceanic links.
-
Hybrid Routing: Seamlessly chains Land
$\rightarrow$ Sea$\rightarrow$ Land connections using landing station "welding" logic. - Lateral Intelligence: Incentivizes submarine routes (0.7x weight) to prefer direct sea paths over long terrestrial detours.
-
Interactive UI:
- Visual preload of global fiber lines via WMS.
- Click-to-set markers for Start and End points.
- Provider Filtering: Click a network provider in the sidebar to highlight only their specific segments in purple.
- Junction Markers: Yellow markers indicate "handoff" points where cables change owners or types.
- Network Stats: Calculates total distance in kilometers and provides an estimated Round Trip Time (RTT) in milliseconds.
fiber-calculator/
├── main.py # FastAPI Backend & Graph Engine
├── static/
│ └── css/
│ └── styles.css # Custom styles (placeholder)
└── templates/
└── index.html # Leaflet.js Frontend
git clone https://github.com/fortless/fiber-pathfinder.git
cd fiber-calculatorEnsure you have Python 3.9+ installed.
pip install fastapi uvicorn requests networkx scipy numpyRun the application using Uvicorn:
python main.pyOr via uvicorn directly:
uvicorn main:app --reloadBy default the app listens on 127.0.0.1:8000. This is changeable in the last line of main.py, otherwise, you can open it in your browser by accessing:
http://127.0.0.1:8000
- Select Points: Click anywhere on the map to set your Start point. Click again to set the End point.
- Calculate: Click the "Calculate Shortest Path" button. The backend will fetch regional infrastructure and build a connectivity graph.
- Explore Providers: Once the path appears, a list of all involved network providers will show in the sidebar. Click any provider name to highlight their specific segments on the map.
- Reset: Use the "Reset Markers" button to clear the map and start a new search.
- FastAPI - Backend framework.
- NetworkX - Graph theory library for Dijkstra's shortest path.
- Leaflet.js - Interactive maps.
- SciPy KDTree - For high-speed spatial "welding" of disconnected cable segments.
- Terrestrial Data: ITU Broadband Maps
- Submarine Data: Submarine Cable Map via TeleGeography.
Note: This tool is for educational and planning purposes. Actual fiber routing depends on BGP policies and private peering agreements.
