@ arcaniz/ 海洋路线
用于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个具有明显海上维护特征的船只类型:
| 类型 | 引用速度 | 典型的西北地区 |
|---|---|---|
container | 20千吨 | 50 000-200 000美元 |
bulk | 14千吨 | 30 000-400 000人 |
tanker | 14千吨 | 5万至320 000美元 |
lng | 19亿吨 | 70 000-180 000人 |
general | 14千吨 | 5 000至40 000人 |
许可证
麻省理工学院 - 看 自由主义。 。 。 .
关于
由 弧线 ——为车队管理人员,承销商,合规团队提供海上风险情报.
ArcNatical提供航行风险分数、制裁筛选、海盗/冲突威胁情报和自动合规报告。 您使用的路由引擎 为我们的商业平台提供了动力.
如果你需要超出航道的海上风险情报, 联系。 。 。 .