Skip to content

Suraj-0210/SeaRouteV2.NET

Repository files navigation

Searoute.NET

A .NET 9.0 library for calculating the shortest sea routes between two points on Earth.

Features

  • 🌊 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

Installation

dotnet add package Searoute.Core

Quick Start

using 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");

Advanced Usage

With Port Selection

var options = new RouteOptions
{
    IncludePorts = true,
    PortParameters = new PortParameters
    {
        OnlyTerminals = true,
        CountryOfLoading = "FR",
        CountryOfDischarge = "CN"
    }
};

var route = await Searoute.CalculateRouteAsync(origin, destination, options);

With Passage Restrictions

var options = new RouteOptions
{
    Restrictions = new[] 
    { 
        Passage.Northwest, 
        Passage.Suez 
    }
};

var route = await Searoute.CalculateRouteAsync(origin, destination, options);

Project Structure

  • Searoute.Core: Main routing engine and algorithms
  • Searoute.Data: Data loaders and embedded resources
  • Searoute.Tests: Unit and integration tests
  • Searoute.Examples: Example applications

License

Apache License 2.0

Credits

Ported from the Python searoute-py library.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages