Skip to content

A simple JavaScript helper to convert a 16-wind compass direction to a degrees heading

License

Notifications You must be signed in to change notification settings

andrewhawkes/compass-direction-to-heading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 i compass-direction-to-heading

Docs

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

Compass Direction Heading Returned
N 360
NNE 23
NE 45
ENE 68
E 90
ESE 113
SE 135
SSE 158
S 180
SSW 203
SW 225
WSW 248
W 270
WNW 293
NW 315
NNW 338

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

About

A simple JavaScript helper to convert a 16-wind compass direction to a degrees heading

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published