A .NET 9.0 library for calculating the shortest sea routes between two points on Earth.
- 🌊 Calculate shortest maritime routes between any two coordinates
- 🚢 Support for 12 major maritime passages (Panama, Suez, Gibraltar, etc.)
- ⚓ Automatic port selection with country filtering
- 📏 Multiple distance units (km, miles, nautical miles, etc.)
- ⏱️ Duration calculations based on vessel speed
- 🗺️ GeoJSON input/output support
- 🚀 High-performance spatial indexing with KD-Tree
- 💪 Modern .NET 9.0 with nullable reference types
dotnet add package Searoute.Coreusing Searoute.Core;
// Define origin and destination
var origin = new Coordinate(0.3515625, 50.064191736659104);
var destination = new Coordinate(117.421875, 39.36827914916014);
// Calculate route
var route = await Searoute.CalculateRouteAsync(origin, destination);
// Display results
Console.WriteLine($"Distance: {route.Properties.Length:F1} {route.Properties.Units}");
Console.WriteLine($"Duration: {route.Properties.DurationHours:F1} hours");var options = new RouteOptions
{
IncludePorts = true,
PortParameters = new PortParameters
{
OnlyTerminals = true,
CountryOfLoading = "FR",
CountryOfDischarge = "CN"
}
};
var route = await Searoute.CalculateRouteAsync(origin, destination, options);var options = new RouteOptions
{
Restrictions = new[]
{
Passage.Northwest,
Passage.Suez
}
};
var route = await Searoute.CalculateRouteAsync(origin, destination, options);- Searoute.Core: Main routing engine and algorithms
- Searoute.Data: Data loaders and embedded resources
- Searoute.Tests: Unit and integration tests
- Searoute.Examples: Example applications
Apache License 2.0
Ported from the Python searoute-py library.