@turf/helpers
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -77,3 +77,3 @@ /// <reference types="geojson" /> | ||
/** | ||
* http://turfjs.org/docs/ | ||
* http://turfjs.org/docs/#radianstodistance | ||
*/ | ||
@@ -83,3 +83,3 @@ export function radiansToDistance(radians: number, units?: Units): number | ||
/** | ||
* http://turfjs.org/docs/ | ||
* http://turfjs.org/docs/#distancetoradians | ||
*/ | ||
@@ -89,4 +89,9 @@ export function distanceToRadians(distance: number, units?: Units): number | ||
/** | ||
* http://turfjs.org/docs/ | ||
* http://turfjs.org/docs/#distancetodegrees | ||
*/ | ||
export function distanceToDegrees(distance: number, units?: Units): number | ||
/** | ||
* http://turfjs.org/docs/#bearingtoangle | ||
*/ | ||
export function bearingToAngle(alpha: number): number |
21
index.js
@@ -322,2 +322,20 @@ /** | ||
/** | ||
* Converts any bearing angle from the north line direction (positive clockwise) | ||
* and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line | ||
* | ||
* @name bearingToAngle | ||
* @param {number} alpha angle | ||
* @returns {number} angle between 0 and 360 degrees | ||
*/ | ||
function bearingToAngle(alpha) { | ||
var beta = alpha % 360; | ||
if (beta < 0) { | ||
beta += 360; | ||
} | ||
return beta; | ||
} | ||
module.exports = { | ||
@@ -335,3 +353,4 @@ feature: feature, | ||
distanceToRadians: distanceToRadians, | ||
distanceToDegrees: distanceToDegrees | ||
distanceToDegrees: distanceToDegrees, | ||
bearingToAngle: bearingToAngle | ||
}; |
{ | ||
"name": "@turf/helpers", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "turf helpers module", | ||
@@ -32,2 +32,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@turf/distance": "^4.2.0", | ||
"benchmark": "^2.1.3", | ||
@@ -34,0 +35,0 @@ "tape": "^3.5.0" |
@@ -265,2 +265,13 @@ # @turf/helpers | ||
# bearingToAngle | ||
Converts any bearing angle from the north line direction (positive clockwise) | ||
and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line | ||
**Parameters** | ||
- `alpha` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** angle between 0 and 360 degrees | ||
<!-- This file is automatically generated. Please don't edit it directly: | ||
@@ -267,0 +278,0 @@ if you find an error, edit the source file (likely index.js), and re-run |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28638
403
300
3