首页 / Turf.js / API 文档
destination
先看结论
从一点按方位角与距离推算另一点,大圆航线的正解公式。
turf.destination(origin, distance, bearing, options?) → Feature<Point>
参数
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
origin | Coord | — | 起点,[lng, lat] 或点要素 |
distance | number | — | 前进距离,单位由 units 决定 |
bearing | number | — | 方位角,-180 到 180,正北为 0,顺时针为正 |
options.units | string | kilometers | miles、kilometers、meters、degrees、radians |
options.properties | object | {} | 结果点的属性 |
示例
var start = turf.point([116.391263, 39.907359]);
var north = turf.destination(start, 2, 0, { units: 'kilometers' });
var east = turf.destination(start, 2, 90, { units: 'kilometers' });
console.log(north.geometry.coordinates);
console.log(east.geometry.coordinates);
正北前进时经度不变、纬度增大;正东前进时纬度基本不变、经度增大。 结果点只保留经纬度,不携带原点的属性。
方位角的取值
传入的方位角以度为单位,正北 0、正东 90、正南 180(或 -180)、正西 -90。 传入 270 也能得到正西方向,函数内部会归一化;但为了避免歧义, 接口与配置里统一用 -180 到 180。
var bearings = [
{ name: '北', deg: 0 },
{ name: '东北', deg: 45 },
{ name: '东', deg: 90 },
{ name: '南', deg: 180 },
{ name: '西', deg: -90 }
];
var ring = bearings.map(function (b) {
return turf.destination(start, 5, b.deg, { units: 'kilometers' });
});
与 circle 的关系
turf.circle 内部就是用 destination 沿 64 个方向
取点再闭合。需要固定顶点数或自定义形状时,可以自己按角度循环调用,
得到任意边数的多边形。
精度说明
公式基于球体假设,地球半径取固定值。短距离(几十公里内)与椭球计算 差异很小;跨洲航线、极区航行会出现公里级偏差。 对精度有要求的长距离计算,需要改用椭球大地测量库。
距离单位默认是公里。
传 destination(pt, 500, 90) 得到的是 500 公里外的点。
米制数据务必写 { units: 'meters' }。
另外 units 支持 degrees 与 radians,
这两种不是长度单位,混用会让结果完全失真。
经纬志(2026)。《destination》。https://www.jingweizhi.com/turf/api/destination.html(访问日期 2026-11-03)。