6.5.0 • Published 9 days ago

@turf/directional-mean v6.5.0

Weekly downloads
8
License
MIT
Repository
github
Last release
9 days ago

@turf/directional-mean

DirectionalMeanLine

Type: Object

Properties

  • 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.

directionalMean

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 (optional, default {})
    • options.planar boolean whether the spatial reference system is projected or geographical. (optional, default true)
    • options.segment boolean whether treat a LineString as a whole or a set of segments. (optional, default false)

Examples

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.

Installation

Install this module individually:

$ npm install @turf/directional-mean

Or install the Turf module that includes it as a function:

$ npm install @turf/turf