1.0.3 • Published 5 years ago

compass-direction-to-heading v1.0.3

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

Compass Direction To Heading

A simple JavaScript helper to convert a 16-wind compass direction to a degrees heading typically used in aviation.

Example Usage

import compassToHeading from 'compass-direction-to-heading';

const heading = compassToHeading('NNW'); // Returns int 338

console.log(heading); // 338

Installation

NPM

npm i compass-direction-to-heading

Docs

The helper function accepts a string (any case) containing one of the 16 point values:

Compass DirectionHeading Returned
N360
NNE23
NE45
ENE68
E90
ESE113
SE135
SSE158
S180
SSW203
SW225
WSW248
W270
WNW293
NW315
NNW338

Heading values are based on 16 points at 22.5deg and rounded up