magvar
v2.0.0
Published
Calculates magnetic variation at a specified location based upon the World Magnetic Model 2025-2030.
Downloads
1,493
Maintainers
Readme
magvar
This package computes the estimated Geomagnetic Declination (which is sometimes called Magnetic variation) at a specified location based upon the World Magnetic Model 2025-2030. More details about the World Magnetic Model can be found here: https://www.ncei.noaa.gov/products/world-magnetic-model
BREAKING CHANGE IN VERSION 2.0
If you are upgrading from version 1, note that the way you import the module has changed, as well as the name of the method you call. The 'get' method in version 1 has now been renamed 'magvar'.
Installation
$ npm install magvar --save
or
$ yarn add magvar
Usage
Input required is a spot location in geodetic (WGS84) latitude and longitude (positive for northern latitudes and eastern longitudes), and altitude.
Altitude is optional and should be specified in kilometers above mean sea level - defaults to 0 if not given.
import {magvar} from 'magvar';
const variation = magvar([latitude], [longitude]);
// or
const variation = magvar([latitude], [longitude], [altitude]);
Take a look at the test file for some examples.
Test
After installing:
npm run test
License
The magvar library is licensed under The MIT License.