Sea Route Distance & Transit Time – Port to Port
Pricing
from $9.10 / 1,000 route calculateds
Sea Route Distance & Transit Time – Port to Port
Sea distance calculator for shipping routes: port-to-port distance in nautical miles and km, transit days at your vessel's speed, canals and straits crossed. Input: UN/LOCODEs, port names or coordinates. Output: one row per route. $14.94/1k routes.
Pricing
from $9.10 / 1,000 route calculateds
Rating
0.0
(0)
Developer
Glidepath
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Features
Share
Get the sea distance between two ports, how many days the voyage takes at your speed, and which canals and straits the route uses, for one route or ten thousand in a single run. Write routes as CNSHA > NLRTM, Shanghai > Rotterdam, Portland, US > Yokohama or 31.23,121.47 > 51.95,4.14. You get one row per route with the distance in nautical miles and kilometres, transit hours and days, the passages crossed (Suez, Panama, Malacca, Cape of Good Hope…), and optionally the route as a GeoJSON line.
Everything is calculated inside the Actor on an open maritime network, with no calls to outside services, so there is no website that can block it or change under it.
Who it is for
- Freight forwarders, logistics and chartering teams: quick distance and sailing-time estimates for quotes, lane comparisons and CO₂ or fuel estimates, without a per-call API subscription.
- Planners looking at disruptions: compare the Suez and the Cape of Good Hope route, or Panama and Cape Horn, with Avoid canals and straits.
- Developers and data teams: enrich shipment tables with port-to-port distances in bulk (JSON, CSV, Excel, API).
- AI agents: answer "how many days from Shanghai to Rotterdam at 14 knots?" through the Apify MCP server.
How to use it
- Put your routes in Routes, one per line, as
FROM > TO. Each end can be a UN/LOCODE (NLRTM), a port name (Rotterdam), a name with a country (Portland, US) orlatitude,longitude. - Optionally set the Speed (knots) (default 14), passages to avoid, the unit for the
distancefield, and whether to include the route line. - Run it and download the rows, or call it from the API, Make, Zapier, n8n or an AI agent.
Input fields
| Field | Type | Default | Description |
|---|---|---|---|
| Routes | |||
routes (required) | array | ["CNSHA > NLRTM", "Singapore > Los Angeles", "Santos, BR … (prefilled) | Routes (FROM > TO). One route per line as 'FROM > TO'. Each end is a UN/LOCODE (CNSHA), a port name (Rotterdam), a name with a country (Portland, US) or 'latitude,longitude' (31.23,121.47). |
| Voyage | |||
speedKnots | number | 14 | Speed (knots). Average speed over the whole route, used for transitHours and transitDays (distance ÷ speed). Use your vessel's average service speed; it applies to every route in the run. |
avoidPassages | array | – | Avoid canals and straits. Find the shortest route that does not use these passages, e.g. Suez to get the route round Africa. Applies to every route in the run; routes with no other way are reported in ERRORS (NO_PATH) and not charged. |
allowArcticRoutes | boolean | false | Allow Arctic routes. Off: the Northwest Passage and the Northern Sea Route are never used. On: they may be used when shorter (seasonal, ice-dependent, permits needed); such rows get a note. |
| Output | |||
distanceUnit | string (one of nm, km, mi) | nm | Unit for the 'distance' field. Nautical miles, kilometres or statute miles. distanceNm and distanceKm are always in the output as well. |
includeGeometry | boolean | false | Include the route line (GeoJSON). Add 'geometry': a GeoJSON LineString of the route (longitude, latitude) for maps and GIS tools. Longitudes can go past ±180 so a line across the Pacific stays unbroken. Makes each row larger. |
Input example
{"routes": ["CNSHA > NLRTM","Singapore > Los Angeles","Santos, BR > Hamburg, DE","31.23,121.47 > 51.95,4.14"],"speedKnots": 14,"avoidPassages": [],"allowArcticRoutes": false,"distanceUnit": "nm","includeGeometry": false}
Through the API an item of routes can also be an object, which lets you pass your own reference along: {"from": "CNSHA", "to": {"lat": 51.95, "lon": 4.14}, "id": "PO-4711"}.
How a port is found: first as a UN/LOCODE (the codes listed in the World Port Index, plus our own list of standard codes it writes differently, such as CNSHA or IEDUB), then by name, ignoring case and accents (Montréal = Montreal), generic words such as "Port of" or "Harbour" (Colon also finds Puerto Colon), and the port's alternate names (St Petersburg finds Sankt-Peterburg). A country after a comma or in brackets narrows the search (Lagos, NG, Felixstowe, UK, Portland (US)). If a name matches several ports, the one with the largest World Port Index harbour-size class is used and the row gets a note naming the others; the class describes the harbour, not its cargo volume. If two or more share the largest class, the row fails with the candidates listed (for example, the World Port Index lists Lagos as a large harbour in both Nigeria and Portugal). You can also write WPI 31140 to pick an exact World Port Index entry.
Output example
{"routeIndex": 1,"routeId": null,"from": {"input": "CNSHA", "name": "Shanghai", "locode": "CNSHA", "country": "CN", "lat": 31.216667, "lon": 121.5, "matchedBy": "locode"},"to": {"input": "NLRTM", "name": "Rotterdam", "locode": "NLRTM", "country": "NL", "lat": 51.9, "lon": 4.483333, "matchedBy": "locode"},"distanceNm": 10580.8,"distanceKm": 19595.7,"distance": 10580.8,"distanceUnit": "nm","speedKnots": 14.0,"transitHours": 755.8,"transitDays": 31.49,"passages": ["malacca", "bab-el-mandeb", "suez", "gibraltar"],"avoidedPassages": ["arctic"],"snapDistanceNm": {"from": 17.6, "to": 1.0},"notes": [],"geometry": null,"calculatedAt": "2026-11-21T16:31:27Z"}
| Field | Type | Description |
|---|---|---|
routeIndex | integer | Position of the route in your input (1 = first); ERRORS uses the same number |
routeId | string / null | The id you gave the route (object input via the API), else null |
from | object | Origin: input, name, locode, country (ISO 3166 alpha-2), lat, lon, matchedBy (locode, name, alias, wpi or coordinates) |
to | object | Destination, same fields as from |
distanceNm | number | Sea distance in nautical miles (1 nm = 1.852 km), including the straight legs from each end to the network |
distanceKm | number | The same distance in kilometres |
distance | number | The same distance in the unit you chose (distanceUnit) |
distanceUnit | string | nm, km or mi |
speedKnots | number | Speed used for the transit time |
transitHours | number | distanceNm ÷ speedKnots, in hours (sailing time only) |
transitDays | number | transitHours ÷ 24 |
passages | array | Canals, straits and capes on the route, in order: suez, panama, malacca, gibraltar, bab-el-mandeb, hormuz, bosphorus, dardanelles, sunda, cape-horn, cape-of-good-hope, bering, arctic |
avoidedPassages | array | Passages the route was not allowed to use (arctic unless Arctic routes are allowed) |
snapDistanceNm | object | {from, to}: how far each end was from the nearest point of the sea-lane network, in nautical miles |
notes | array | Plain-language notes: which port was chosen for an ambiguous name, ends far from the network, Arctic routes |
geometry | object / null | GeoJSON LineString of the route (only with Include the route line), else null. Longitudes can go past ±180 so that a line across the Pacific stays unbroken; tools that need -180 to 180 (for example BigQuery or Snowflake GEOGRAPHY) need the line split at the antimeridian first |
calculatedAt | string | ISO 8601 UTC |
Routes that could not be calculated are listed in the run's key-value store as ERRORS with their routeIndex, the reason (UNKNOWN_PORT, AMBIGUOUS_PORT, UNKNOWN_COUNTRY, BAD_COORDINATES, BAD_INPUT, SAME_PLACE, NO_PATH, NOT_NEAR_SEA, or ERROR for an unexpected problem with that row) and what to change; they are never charged and the run's status message counts them. If no route at all can be calculated, the run fails with the first reasons in its status message. SUMMARY holds the totals and the engine version.
Use it with
- Spreadsheets and BI: export CSV or Excel, or read the dataset from Google Sheets through the Integrations tab.
- Make, Zapier, n8n: call the Actor with a list of routes and use the rows in your flow.
- API and code: the Apify API or the JavaScript and Python clients; send
{"from", "to", "id"}objects to keep your own shipment IDs. - AI agents: through the Apify MCP server this Actor is a tool that takes a list of routes and returns distances and days.
Pricing
Pay per route: $14.94 per 1,000 routes on the Apify Free plan; on paid plans $12.99 (Starter), $11.04 (Scale) and $9.10 (Business and higher) (the price for your plan is shown on the Pricing tab). The examples below use the Free-plan price. Only routes that are calculated and saved are charged; rows with an unknown or ambiguous port, no sea path or a point far from the sea are free. The route line is included in the price.
- A lane table of 1,000 port pairs → about $14.94.
- 5,000 routes → about $74.70.
- 10,000 routes, the most one run takes → about $149.40.
A small start fee of $0.00005 per run applies. Set a maximum cost per run in the run options and the Actor stops cleanly when it is reached.
How accurate is it?
These are planning estimates, not navigation. The routes follow a coarse network of main shipping lanes, not a ship's actual track, and transit time is distance ÷ speed only: no port time, canal queues, weather, currents or speed changes.
We compared the Actor with 24 lanes from NOAA's Distances Between United States Ports (2026, 15th edition), including routes through the Panama Canal and to Hawaii: the median difference was 1.3%, 21 of the 24 lanes were within 5%, and the largest difference was 9.8% on short coastal legs on the US West Coast (San Francisco–Seattle 886 nm against NOAA's 807). The Actor's distances tend to be slightly longer than NOAA's. Short coastal routes are where the coarse network shows most.
- The network: the maritime network shipped with the open-source searoute-py package 1.6.0 (about 9,700 points), which credits Eurostat's SeaRoute. SeaRoute's documentation says its network is based on Oak Ridge National Laboratory's Global Shipping Lane Network, World, 2000, with lines added around European coasts from AIS data; searoute-py has adjusted it since (more passages, the Baltic Sea in 2024, fixes in 2026).
- Port to network: each end is joined to the nearest network point by a straight line, and that line is counted in the distance.
snapDistanceNmshows how long it is; across the World Port Index, half of all ports are within 14 nm. Rows where it is over 50 nm get a note; ends more than 300 nm from any sea lane (inland river ports such as Manaus) are not calculated. - Not in the network: the Kiel and Corinth canals (Baltic routes go round Skagen), inland waterways, and ice, piracy or war-risk areas. Avoiding Suez usually gives the Cape of Good Hope route, but where Panama is shorter the network uses Panama; avoid both to force the Cape.
- Arctic routes (Northwest Passage, Northern Sea Route) are off by default because they are seasonal and need permits and ice-class ships.
Limits
- Up to 10,000 routes per run; about 3,800 ports from the NGA World Port Index plus any point you give as coordinates.
- UN/LOCODEs are matched against the codes the World Port Index lists plus our own list of standard codes for big ports. A code that is in neither (often a new terminal) fails that row for free; use the port name or coordinates instead.
- Speed between 1 and 50 knots; one speed and one set of avoided passages per run (run again for other settings).
- Measured on one CPU core: 1,000 routes between random medium and large ports in 7 to 9 s; 10,000 routes with the route line in about 70 s. On Apify a run's CPU share grows with its memory, so expect longer at the default 1 GB; give the run more memory (up to 4 GB) for large batches.
- No web requests, no proxies, no logins: the network and the port list are part of the Actor.
FAQ
Is it legal? Yes. The Actor visits no website: it calculates routes on open data inside the run. The routing engine searoute-py is Apache-2.0 licensed, its maritime network comes from Eurostat's SeaRoute under the EUPL-1.2, and the port list is the US Government's World Port Index, on which no copyright is claimed. Links to their sources and licences are under Open data and licences below. The output has no personal data.
Can I use it for navigation? No. It is for estimates in planning, quoting and analysis. The library's own documentation says it is not for routing ships.
Why is my port's locode different from the one I typed? Some World Port Index entries carry another code for the same harbour (for example Shanghai is CNSGH there); for the big ports we show the standard code you are likely to use. The port's name and coordinates are in from/to so you can check the match.
My port name was not found. What now? The ERRORS record suggests close matches. Use the UN/LOCODE, add a country (Victoria, SC), or give latitude,longitude of the berth.
How do I compare Suez with the Cape route? Run your routes twice: once as they are and once with Avoid canals and straits set to Suez (add Panama too when the network would otherwise use it). The passages field shows which way each route went.
Is transit time door-to-door? No, it is sailing time at the speed you set. Add port stays, canal transits and waiting yourself.
Open data and licences
The Actor calculates on open software and open data. All of it is used unmodified and comes without warranty.
- Routing engine: searoute-py 1.6.0 by Gent Halili, under the Apache License 2.0. Source: https://github.com/genthalili/searoute-py
- Maritime network: shipped in searoute-py, which credits Eurostat's SeaRoute (© European Union) for it, under the European Union Public Licence v. 1.2 (EUPL-1.2 text). Source: https://github.com/eurostat/searoute and the searoute-py package above, where the network's source is freely available. SeaRoute's documentation says the network is based on Oak Ridge National Laboratory's Global Shipping Lane Network, World, 2000.
- Ports: the NGA World Port Index (Pub. 150), prepared and published by the US National Geospatial-Intelligence Agency. No copyright claimed under Title 17 U.S.C.; use of the data does not imply endorsement by NGA.
The full notices and the EUPL-1.2 text also ship with the Actor's source (NOTICE and LICENSES/EUPL-1.2.txt).
Changelog
See CHANGELOG.md.
Support
Found a problem, a port that is matched wrongly or a route that looks odd? Open an issue on the Actor's Issues tab with the route you used. We read every one and answer it there.