Skip to content

eurostat/searoute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SeaRoute

Maven Central

SeaRoute computes shortest maritime routes between two locations.

See below an example from Marseille (5.3E,43.3N) to Shanghai (121.8E,31.2N). The red line is the computed maritime route. The black line is the great-circle route.

From Marseille to Shangai

Usage

As a program

SeaRoute requires Java 1.9 or higher. Run java --version to check if Java is installed and what is the current version.

Download the lastest release here and unzip it somewhere.

Examples of executions for windows users are provided in searoute.bat (for linux users, see searoute.sh). test_input.csv is an example of input file. It is a simple CSV file with origin/destination coordinates of the routes. Note that only geographical coordinates (decimal degrees) are supported. The output file is a GeoJSON (*.geojson) file. This file can be displayed with any modern GIS software such as QGIS, or also with geojson.io. Each route has the same properties as the input CSV file, with three additional properties:

  • distKM, which is the length of the route, in KM
  • dFromKM (respectivelly dToKM), which is the distance in KM between the origin (repectivelly destination) position and the closest node of the maritime network. This value measure the approximation arount the origin (respectivelly destination) position. The smaller, the better.

Run java -jar searoute.jar -h to see the help, with a description of all input parameters.

Example

For coders

SeaRoute can be used as a Java library, which can be retrieved using Maven. For that, simply add it as a dependency to the pom.xml file:

<dependency>
	<groupId>eu.europa.ec.eurostat</groupId>
	<artifactId>searoute-core</artifactId>
	<version>X.Y</version>
</dependency>

Where X.Y is the current version number, as available Maven central repository.

For more information on how to setup a coding environment based on Eclipse, see this page.

Here is an example of shortest maritime route computation:

//create the routing object
SeaRouting sr = new SeaRouting();

//get the route between Marseille (5.3E,43.3N) and Shanghai (121.8E,31.2N)
Feature route = sr.getRoute(5.3, 43.3, 121.8, 31.2);

//compute the route distance in km
MultiLineString routeGeom = (MultiLineString) route.getGeometry();
double d = GeoDistanceUtil.getLengthGeoKM(routeGeom);

For further overview, see the documentation.

As a webservice

To deploy SeaRoute as a webservice (Java servlet), run:

git clone https://github.com/eurostat/searoute.git
cd modules/searoute-war
mvn clean package

and move the servlet /target/searoute-XXX.war into your /tomcatX.Y/webapps/ folder. Go then to http://localhost:8080/searoute/ to see the REST-API documentation and some examples.

Some additional information

The shortest maritime routes are computed from a network of lines covering the seas and following some of the most frequent martitime routes. This maritime network is based on the Oak Ridge National Labs CTA Transportation Network Group, Global Shipping Lane Network, World, 2000 (retrieved from geocommons.com or github), enriched with some additional lines around the European coasts based on AIS data. Simplified versions of this network have been produced for different resolutions (5km, 10km, 20km, 50km, 100km) based on a shrinking of too short edges and a removal of similar edges. For more detail on this generalisation algorithm, see the marnet module based on (JGiscoTools)[https://github.com/eurostat/JGiscoTools].

Maritime network overview

SeaRoute can be reused with custom maritime networks produced from some other custom maritime line datasets. The module marnet provides some utilities and examples for the creation and preparation of such maritime network datasets, with generalisation methods. To be able to handle channels, straits and passages such as Suez and Panama channels, the custom maritime sections need to be characterised with a new property pass set with the values suez and panama for the network sections passing by the Suez and Panama channels. The program will then be able to recognise them and possibly avoid them, on user request. The following straits, channels and passages are currently supported:

  • Suez channel
  • Panama channel

since version v3.5:

  • Malacca strait
  • Gibraltar strait
  • Dover strait
  • Bering strait
  • Magellan strait
  • Bab-el-Mandeb strait
  • Kiel channel
  • Corinth channel
  • Northwest passage
  • Northeast passage

The shortest maritime routes are computed from this network using the Dijkstra's algorithm implemented in the wonderful GeoTools library.

Support and contribution

Feel free to ask support, fork the project or simply star it (it's always a pleasure). If anyone feels like helping fixing the existing issues, you are welcome !