Type: Object
-
cartesianAngle
number the mean angle of all lines. (measure from due earth counterclockwise). -
bearingAngle
number the mean angle of all lines. (bearing). -
circularVariance
number the extent to which features all point in the same direction. the value ranges 0-1, the bigger the value, the more variation in directions between lines. -
averageX
number the centroid of all lines. -
averageY
number the centroid of all line. -
averageLength
number the average length of line. -
countOfLines
number the count of features.
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.
-
lines
FeatureCollection<LineString> -
options
object (optional, default{}
)
var lines = turf.lineStrings([
[[110, 45], [120, 50]],
[[100, 50], [115, 55]],
])
var directionalMeanLine = turf.directionalMean(lines);
// => directionalMeanLine
Returns DirectionalMeanLine Directional Mean Line
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/directional-mean
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf