You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Maritime Shortest Path Calculator
An interactive web application that calculates the shortest maritime routes between any two points on the globe using advanced graph algorithms.
## Features
- πΊοΈ **Interactive Map**: Click on any two points to calculate the shortest maritime route
- π’ **Multiple Routing Graphs**: Choose between MarNet and Oak Ridge maritime networks
- π **Globe Wrapping**: Properly handles routes that cross the international date line
- π **Route Statistics**: View distance, waypoints, and routing information
- π± **Responsive Design**: Works on desktop and mobile devices
- β‘ **Real-time Calculation**: Fast API-based route computation
## Installation
1. Clone this repository:
```bash
git clone
cd shortestpath
```
2. Install the required dependencies:
```bash
pip install -r requirements.txt
```
## Usage
1. Start the Flask development server:
```bash
python app.py
```
2. Open your web browser and navigate to:
```
http://localhost:5000
```
3. Use the application:
- Click on the map to select your origin point (green marker A)
- Click again to select your destination point (red marker B)
- The shortest route will be calculated automatically
- View route statistics in the information panel below the map
- Use the "Clear Map" button to start over
- Switch between different routing graphs using the dropdown
## API Endpoints
### POST /api/shortest-path
Calculate the shortest path between two points.
**Request Body:**
```json
{
"origin": {
"lat": 31.23,
"lng": 121.47
},
"destination": {
"lat": 32.08,
"lng": -81.09
},
"graph_type": "marnet"
}
```
**Response:**
```json
{
"success": true,
"data": {
"length": 12500.5,
"coordinate_path": [[lat, lng], ...],
"clean_paths": [[[lat, lng], ...], ...]
}
}
```
### GET /api/graph-info
Get information about available routing graphs.
## Graph Types
- **MarNet**: Maritime routing network optimized for general maritime navigation
- **Oak Ridge**: Oak Ridge maritime routing network with specialized routing algorithms
## Technical Details
- **Backend**: Flask (Python)
- **Frontend**: HTML5, CSS3, JavaScript, Leaflet.js
- **Routing Engine**: SCGraph library
- **Map Visualization**: Leaflet with OpenStreetMap tiles
## Dependencies
- `scgraph>=2.12.0`: Core routing algorithms and maritime graphs
- `folium==0.16.0`: Map visualization (for the original script)
- `flask>=2.0.0`: Web framework
- `flask-cors>=4.0.0`: Cross-origin resource sharing
## Original Script
The original `getting_started.py` file contains examples of how to use the SCGraph library directly without the web interface. You can still run it for command-line usage:
```bash
python getting_started.py
```
## Contributing
Feel free to submit issues and enhancement requests!
## License
This project is open source and available under the MIT License.
# routing