@arcnautical/maritime-routing

中文文档
1.0.1发布于 2026/09/18MITTypeScriptES Module零依赖近 30 天下载 2306

出产级出海航道发动机——A*出海航道勘察,Dijkstra出海航道点出海航道,510+出海口数据库,有气象意识的ETA,EEZ分析. 零从属.

中文使用文档
文档目录21 节
  1. 为什么会这样
  2. 特征
  3. 安装
  4. 快速启动
  5. API 参考
  6. 路由计算
  7. 海洋路径调查
  8. 端口数据库
  9. 天气速度模型
  10. EEZ 过境分析
  11. 大地测量设施
  12. 数据来源
  13. 业绩
  14. 与海道的比较
  15. 高级使用
  16. 自定义海洋网格
  17. 生成自己的海洋网格
  18. 海洋区域
  19. 船舶类型
  20. 许可证
  21. 关于

@ arcaniz/ 海洋路线

npm version npm downloads License: MIT Tests: 42 passing Zero dependencies GitHub stars

用于JavaScript/TypeScript的生产级海上通路引擎. 零从属.

计算全世界任何两个港口之间的现实海洋航道,保证能避让土地、了解天气的ETA和专属经济区过境分析.

为什么会这样

每一个航运技术的启动都重塑了海上航道。 现有的开源选项( :海路号 ——自2020年以来未保持,使用2000年数据)生产使用不足. 商业API每年收费600-6900欧元.

此库取自 弧线,海洋风险情报平台. 对1 790条真实世界路线进行了测试,陆地过境率为0%.

这个引擎能驱动活航风险产品. @arcnautical/maritime-routing 是开源核心 弧线是因为 车道风险情报。 live app take any profile - > 目的地航道并给它打分 制裁曝光 海盗/冲突 窒息性依赖和天气 然后电子邮件给你 a 该具体走廊的路由风险简介.

在您自己的车道上尝试一下 - 完整的计算结果显示为没有注册 : https://arcaniz.com (中文(简体) )

特征

特性说明
A. 海洋路径调查从OpenStreetMap衍生出0.05°海洋位图上的道路(7200x3600细胞). 路线保证永不跨越陆地.
Dijkstra 路口路线48个战略阻塞点(苏伊士,巴拿马,马六甲,直布罗陀等地)有相距加权图路由.
510+ 港口数据库联合国/LOCODE标准。 按姓名、国家或代码搜索。 包括坐标、港口类型和海洋区域.
天气速度模型基于Beaufort的减速(Kwon,2008年;Lu等2015年). 每个船型和装载条件。 具有Cbeta因子的方向意识.
EEZ 过境分析检测哪个专属经济区是过境路线。 制裁也包括在内.
避免区域环绕用户指定多边形(如海盗区,冲突地区)的路线.
路由点强制路线通过特定的坐标.
GeoJSON 输出所有路线作为GeoJSON LineString返回,准备进行地图渲染.

安装

npm install @arcnautical/maritime-routing

需要节点.js QQ 18.

快速启动

import { computeRoute } from '@arcnautical/maritime-routing';

// Compute a route from Singapore to Rotterdam
const route = computeRoute('SGSIN', 'NLRTM');

console.log(route.distance_nm);        // ~8,440 nm
console.log(route.duration_hours);      // ~603 hours at 14 knots
console.log(route.waypoints.length);    // waypoints transited
console.log(route.hazard_zones_crossed); // chokepoints on route

// GeoJSON for map rendering
const geojson = route.route_geojson;
// -> FeatureCollection with LineString geometry

API 参考

路由计算

import {
  computeRoute,
  computeRouteInternal,
} from '@arcnautical/maritime-routing';

// Simple route (returns handler-compatible format)
const route = computeRoute('SGSIN', 'NLRTM');

// Route with options
const route = computeRoute('SGSIN', 'NLRTM', {
  avoid_zones: [[[30, 12], [50, 12], [50, 32], [30, 32], [30, 12]]], // avoid Red Sea
  via_waypoints: [{ lat: -34.4, lon: 18.5 }], // force via Cape of Good Hope
});

// Internal format (with segment breakdown)
const internal = computeRouteInternal('SGSIN', 'NLRTM');
console.log(internal.segments);       // per-leg distance + bearing
console.log(internal.totalDistanceNm);
console.log(internal.geojson);        // GeoJSON Feature

海洋路径调查

import { findOceanPath } from '@arcnautical/maritime-routing';

// Find a path between two coordinates
// Returns [lon, lat][] (GeoJSON convention)
const path = findOceanPath(1.26, 103.84, 51.90, 4.50);
// -> ~500 coordinate pairs, guaranteed to never cross land

// Performance: 8-50ms for typical segments
// Automatically subdivides routes > 5,000nm

端口数据库

import {
  searchPorts,
  getPortByLocode,
  getPortsByRegion,
  resolveAisDestination,
  findNearestPort,
  PORTS,
} from '@arcnautical/maritime-routing';

// Search by name, country, or LOCODE
const ports = searchPorts('Singapore');    // [{ locode: 'SGSIN', ... }]
const ports = searchPorts('Japan', 50);   // up to 50 results

// Exact lookup
const sg = getPortByLocode('SGSIN');      // { name: 'Singapore', lat: 1.26, ... }

// By region
const medPorts = getPortsByRegion('mediterranean'); // 30+ ports

// Parse messy AIS destination strings
const port = resolveAisDestination('NL RTM');   // -> Rotterdam
const port = resolveAisDestination('>>SGSIN<<'); // -> Singapore

// Find nearest port to coordinates
const port = findNearestPort(51.9, 4.5);  // -> Rotterdam

// All 510+ ports
console.log(PORTS.length);

天气速度模型

import {
  computeSeaStateFactor,
  computeRouteEta,
  windToBeaufort,
  waveToBeaufort,
} from '@arcnautical/maritime-routing';

// Compute speed reduction from weather
const result = computeSeaStateFactor({
  baseSpeedKnots: 14,
  waveHeightM: 3.0,
  windSpeedKt: 25,
  swellHeightM: 1.5,
  vesselType: 'bulk',     // container | bulk | tanker | lng | general
  loadCondition: 'laden', // laden | ballast
  // Optional direction-aware inputs:
  waveDirectionDeg: 270,
  vesselHeadingDeg: 90,   // heading into waves = worst case
});

console.log(result.effectiveSpeedKnots); // reduced speed
console.log(result.beaufortNumber);      // 6
console.log(result.speedReductionPct);   // % reduction
console.log(result.seaStateFactor);      // 0-1 retention

// Compute ETA for a full route
const eta = computeRouteEta(
  segments,          // [{ distanceNm, bearing }]
  segmentWeather,    // per-segment weather data
  14,                // base speed (knots)
  'container',       // vessel type
  'laden',           // load condition
);
console.log(eta.totalTransitHours);
console.log(eta.worstSegmentIndex);

EEZ 过境分析

import { analyzeRouteEezTransit } from '@arcnautical/maritime-routing';

const result = analyzeRouteEezTransit(segments, totalDistanceNm);

for (const eez of result.transitEezs) {
  console.log(`${eez.countryName}: ${(eez.routeFraction * 100).toFixed(1)}%`);
  if (eez.isSanctioned) console.log('  ⚠ SANCTIONED');
}

console.log(result.sanctionedEezFraction); // 0-1
console.log(result.summary);              // human-readable

大地测量设施

import {
  haversineDistance,
  haversineDistanceNm,
  bearing,
  interpolateGreatCircle,
  pointInPolygon,
} from '@arcnautical/maritime-routing';

// Distance in nautical miles
const nm = haversineDistanceNm(1.26, 103.84, 51.90, 4.50); // ~5,700

// Initial bearing (degrees)
const brg = bearing(1.26, 103.84, 51.90, 4.50); // ~315°

// Great circle arc interpolation
const points = interpolateGreatCircle(0, 0, 45, 90, 100);
// -> 101 [lat, lon] pairs along the arc

// Point-in-polygon test
const inside = pointInPolygon(5, 5, [[0,0], [10,0], [10,10], [0,10]]);

数据来源

数据来源许可证
海洋网格OpenStreetMap 水多边形ODbL 数据
端口数据库UN/LOCODE+公共海洋数据公有领域
速度模型Kwon 2008,Lu等2015 (英语)学术文献
专属经济区边界联合国大陆架界限委员会/佛兰德海洋研究所公有领域
路径图公共海事知识不详

业绩

运行时间
端口查询( LOCODE)< 0.1毫米口径
端口搜索( 按名称)< 1 分钟
海洋路径调查(单一部分)8-50毫米口径
完全路线计算(新加坡-鹿特丹)约250米
速度模型计算< 0.1毫米口径
网格装入( 只有第一次通话)~900毫秒( x)

包大小:~200KB (编译JS)+106KB (海洋网格)+90KB (EEZ数据).

与海道的比较

特性@ arcaniz/ 海洋路线海路号
上次更新2026 (英语)2020 (英语)
类型脚本土著没有
依赖关系无多个
回避土地保证d (位图)没有( 仅是图表)
端口数据库510+ 港口无
天气模型Beaufort + 克贝塔无
专属经济区分析对无
避免区域对没有
路由点对没有
狭窄的通道苏伊士,巴拿马,博斯普鲁斯等地.有限
决议0.05°(~5.5公里)变量
数据来源OSM (2024) (英语)ORNL(2000年)

高级使用

自定义海洋网格

import { setGridPath, loadGridFromBuffer } from '@arcnautical/maritime-routing';

// Use a custom grid file
setGridPath('/path/to/my-ocean-grid.bin.gz');

// Or load from a buffer (e.g., fetched from CDN)
const buffer = await fetch('https://cdn.example.com/ocean-grid.bin.gz')
  .then(r => r.arrayBuffer());
loadGridFromBuffer(new Uint8Array(buffer));

生成自己的海洋网格

海洋网由OSM水多形文件产生:

# Download water polygons from osmdata.openstreetmap.de
# Then run the generator:
npx tsx scripts/generate-ocean-grid.ts /path/to/water_polygons.shp

海洋区域

港口分为16个海洋区,用于通航:

pacific, (中文(简体) ), south_china_sea, (中文(简体) ), southeast_asia, (中文(简体) ), indian_ocean, (中文(简体) ), persian_gulf, (中文(简体) ), red_sea, (中文(简体) ), mediterranean, (中文(简体) ), atlantic_north, (中文(简体) ), atlantic_south, (中文(简体) ), caribbean, (中文(简体) ), north_sea, (中文(简体) ), baltic, (中文(简体) ), black_sea, (中文(简体) ), arctic, (中文(简体) ), oceania, (中文(简体) ), east_pacific

船舶类型

速度模型支持5个具有明显海上维护特征的船只类型:

类型引用速度典型的西北地区
container20千吨50 000-200 000美元
bulk14千吨30 000-400 000人
tanker14千吨5万至320 000美元
lng19亿吨70 000-180 000人
general14千吨5 000至40 000人

许可证

麻省理工学院 - 看 自由主义。 。 。 .

关于

由 弧线 ——为车队管理人员,承销商,合规团队提供海上风险情报.

ArcNatical提供航行风险分数、制裁筛选、海盗/冲突威胁情报和自动合规报告。 您使用的路由引擎 为我们的商业平台提供了动力.

如果你需要超出航道的海上风险情报, 联系。 。 。 .

版本与发布记录

@arcnautical/maritime-routing 共发布 2 个版本,首次发布于 2026/03/23;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.1latest2026/09/181 个月前
1.0.02026/03/237 个月前

关于 @arcnautical/maritime-routing 的常见问题

@arcnautical/maritime-routing 是什么?

出产级出海航道发动机——A*出海航道勘察,Dijkstra出海航道点出海航道,510+出海口数据库,有气象意识的ETA,EEZ分析. 零从属.

如何安装 @arcnautical/maritime-routing?

在项目目录运行 npm install @arcnautical/maritime-routing,或使用 pnpm add / yarn add / bun add。

@arcnautical/maritime-routing 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@arcnautical/maritime-routing 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@arcnautical/maritime-routing 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@arcnautical/maritime-routing 可以商用吗?

@arcnautical/maritime-routing 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@arcnautical/maritime-routing 的下载量有多少?

根据 npm 官方下载统计,@arcnautical/maritime-routing 在 2026/10/07 – 2026/11/05 这 30 天内被下载 2,306 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@arcnautical/maritime-routing 还在维护吗?

最新版本 1.0.1 发布于 2026/09/18(1 个月前);至今共发布 2 个版本,其中过去 12 个月发布了 2 个;首次发布于 2026/03/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。