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
Name | Type | Description |
---|---|---|
lines | FeatureCollection<LineString> | |
options? | object | (default {}) |
options.planar? | boolean | whether the spatial reference system is projected or geographical. (default true) |
options.segment? | boolean | whether treat a LineString as a whole or a set of segments. (default false) |
Returns
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(...);