transformTranslate
描述
¥Description
沿指定方向角的恒向线移动指定距离的任何 GeoJSON 要素或几何体。
¥Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line on the provided direction angle.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | GeometryCollection | 要平移的对象 |
distance | number | 运动长度;负值表示反方向运动 |
direction | number | 运动的长度;以十进制度数表示的与北的夹角,顺时针方向为正 |
options? | 对象 | 可选参数(默认 {}) |
options.units? | 单位 | 其中 distance 将以下列单位表示;英里、公里、度或弧度(默认值为 'kilometers') |
options.zTranslation? | number | 垂直运动的长度,与距离单位相同(默认值为 0) |
options.mutate? | boolean | 允许 GeoJSON 输入发生修改(如果为 true,则性能显著提升)(默认为 false) |
返回
¥Returns
GeoJSON | GeometryCollection 转换后的 GeoJSON 对象
¥GeoJSON | GeometryCollection the translated GeoJSON object
示例
¥Examples
var poly = turf.polygon([
[
[0, 29],
[3.5, 29],
[2.5, 32],
[0, 29],
],
]);
var translatedPoly = turf.transformTranslate(poly, 100, 35);
安装
¥Installation
$ npm install @turf/transform-translate
import { transformTranslate } from "@turf/transform-translate";
const result = transformTranslate(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.transformTranslate(...);