Searoute.NET 1.0.1

Suggested Alternatives

Searoute.Core

Additional Details

Please use the package SeaRoute.Core for better result and optimized solution .
Thanks all.

There is a newer version of this package available.
See the version list below for details.
dotnet add package Searoute.NET --version 1.0.1
                    
NuGet\Install-Package Searoute.NET -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Searoute.NET" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Searoute.NET" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Searoute.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Searoute.NET --version 1.0.1
                    
#r "nuget: Searoute.NET, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Searoute.NET@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Searoute.NET&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Searoute.NET&version=1.0.1
                    
Install as a Cake Tool

Searoute.NET

A .NET package for generating the shortest sea route between two points on Earth.

If points are on land, the function will attempt to find the nearest point on the sea and calculate the route from there.

Not for routing purposes! This library was developed to generate realistic-looking sea routes for visualizations of maritime routes, not for mariners to route their ships.

Installation

dotnet add package Searoute.NET

Or via NuGet Package Manager:

Install-Package Searoute.NET

Usage

using Searoute.NET;
using Searoute.NET.Models;

// Define origin and destination GeoJSON points
var origin = new GeoJsonFeature
{
    Type = "Feature",
    Properties = new Dictionary<string, object>(),
    Geometry = new GeoJsonPoint
    {
        Type = "Point",
        Coordinates = new[] { 132.5390625, 21.616579336740603 }
    }
};

var destination = new GeoJsonFeature
{
    Type = "Feature",
    Properties = new Dictionary<string, object>(),
    Geometry = new GeoJsonPoint
    {
        Type = "Point",
        Coordinates = new[] { -71.3671875, 75.05035357407698 }
    }
};

// Calculate route
var service = SearouteService.Instance;
var route = service.CalculateRoute(origin, destination);
// Returns a GeoJSON LineString Feature

// Optionally, define the units for the length calculation
// Defaults to nautical miles ("nm"), can be "degrees", "miles", "kilometers"/"km"
var routeMiles = service.CalculateRoute(origin, destination, "miles");

// Access route properties
Console.WriteLine($"Route length: {route.Properties["length"]} {route.Properties["units"]}");

Features

  • Calculate shortest maritime routes between any two points on Earth
  • Automatic snapping to maritime network for land-based coordinates
  • Support for multiple distance units (nautical miles, miles, kilometers, degrees)
  • GeoJSON-compatible input and output
  • Based on proven Dijkstra pathfinding algorithm

License

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).

Credits

  • Based on Eurostat's Searoute Java library (EUPL-1.2 licensed)
  • Maritime network data derived from Eurostat's marnet dataset
  • Original JavaScript implementation: searoute-js

Requirements

  • .NET 9.0 or higher
  • NetTopologySuite for geospatial operations
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.