Geodesic routines from GeographicLib
This library is a JavaScript implementation of the geodesic routines
from GeographicLib. This solves the
direct and inverse geodesic problems for an ellipsoid of revolution.
Licensed under the MIT/X11 License; see
LICENSE.txt.
WARNING: Since version 2.x, this package has been separated into the
geographiclib-geodesic
and
geographiclib-dms
packages. geographiclib
will be deprecated on 2023-05-01.
Installation
$ npm install geographiclib
Usage
In node, do
var GeographicLib = require("geographiclib");
Documentation
Full documentation is provided at
https://geographiclib.sourceforge.io/JavaScript/1.52.2/index.html.
Examples
var GeographicLib = require("geographiclib"),
geod = GeographicLib.Geodesic.WGS84, r;
r = geod.Inverse(-41.32, 174.81, 40.96, -5.50);
console.log("The distance is " + r.s12.toFixed(3) + " m.");
r = geod.Direct(-32.06, 115.74, 225, 20000e3);
console.log("The position is (" +
r.lat2.toFixed(8) + ", " + r.lon2.toFixed(8) + ").");
Authors