directionalMean
描述
¥Description
此模块计算一组线的平均角度,并测量其趋势。它既可以在项目坐标系中使用,也可以在地理坐标系中使用。它可以处理线段或整条线。
¥This module calculate the average angle of a set of lines, measuring the trend of it. It can be used in both project coordinate system and geography coordinate system. It can handle segments of line or the whole line.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
lines | FeatureCollection<LineString> | |
options? | object | (默认 ---左括号------右括号---) |
options.planar? | boolean | 空间参考系统是投影的还是地理的。(默认 true) |
options.segment? | boolean | 是否将 LineString 视为一个整体还是一组线段。(默认 false) |
返回
¥Returns
DirectionalMeanLine 方向平均线
¥DirectionalMeanLine Directional Mean Line
示例
¥Examples
var lines = turf.lineStrings([
[
[110, 45],
[120, 50],
],
[
[100, 50],
[115, 55],
],
]);
var directionalMeanLine = turf.directionalMean(lines);
// => directionalMeanLine
安装
¥Installation
$ npm install @turf/directional-mean
import { directionalMean } from "@turf/directional-mean";
const result = directionalMean(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.directionalMean(...);