# geographiclib-geodesic

> JavaScript implementation of geodesic routines in GeographicLib

Latest version **2.2.0** (published 2025-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install geographiclib-geodesic
pnpm add geographiclib-geodesic
yarn add geographiclib-geodesic
bun add geographiclib-geodesic
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2025-08-22 |
| First published | 2022-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 287.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | Charles Karney |
| Maintainers | cffk |
| Keywords | geodesics, geometry, geographiclib, geography, geodesic problem, direct geodesic problem, inverse geodesic problem, geodesic calculator |

## Links

- npm: https://www.npmjs.com/package/geographiclib-geodesic
- Repository: https://github.com/geographiclib/geographiclib-js
- Homepage: https://github.com/geographiclib/geographiclib-js#readme
- Issues: https://github.com/geographiclib/geographiclib-js/issues
- npm.io page: https://npm.io/package/geographiclib-geodesic

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2025-08-22
- 2.1.1 — 2024-08-18
- 2.1.0 — 2024-08-18
- 2.0.0 — 2022-04-29
- 2.0.0-beta3 — 2022-04-29
- 2.0.0-beta2 — 2022-04-29
- 2.0.0-beta1 — 2022-04-29

## README

# JavaScript implementation of the geodesic routines in GeographicLib

This package is a JavaScript implementation of the geodesic routines
from [GeographicLib](https://geographiclib.sourceforge.io).  This solves the
direct and inverse geodesic problems for an ellipsoid of revolution.

Prior to version 2.0.0, this was a component of the [node package
geographiclib](https://www.npmjs.com/package/geographiclib).  As of
version 2.0.0, that package was split into the packages
[geographiclib-geodesic](https://www.npmjs.com/package/geographiclib-geodesic)
(this package) and
[geographiclib-dms](https://www.npmjs.com/package/geographiclib-dms).
[geographiclib](https://www.npmjs.com/package/geographiclib) will be
deprecated on 2023-05-01.

Licensed under the MIT/X11 License; see
[LICENSE.txt](https://geographiclib.sourceforge.io/LICENSE.txt).

## Installation

```bash
$ npm install geographiclib-geodesic
```

## Usage

In [node](https://nodejs.org), do
```javascript
var geodesic = require("geographiclib-geodesic");
```

## Documentation

Full documentation is provided at
[https://geographiclib.sourceforge.io/JavaScript/doc](
https://geographiclib.sourceforge.io/JavaScript/doc/index.html).

## Examples

```javascript
var geodesic = require("geographiclib-geodesic"),
    geod = geodesic.Geodesic.WGS84, r;

// Find the distance from Wellington, NZ (41.32S, 174.81E) to
// Salamanca, Spain (40.96N, 5.50W)...
r = geod.Inverse(-41.32, 174.81, 40.96, -5.50);
console.log("The distance is " + r.s12.toFixed(3) + " m.");
// This prints "The distance is 19959679.267 m."

// Find the point 20000 km SW of Perth, Australia (32.06S, 115.74E)...
r = geod.Direct(-32.06, 115.74, 225, 20000e3);
console.log("The position is (" +
            r.lat2.toFixed(8) + ", " + r.lon2.toFixed(8) + ").");
// This prints "The position is (32.11195529, -63.95925278)."
```

## Authors

* algorithms + js code: Charles Karney (karney@alum.mit.edu)
* node.js port: Yurij Mikhalevich (yurij@mikhalevi.ch)

---
_Source: https://npm.io/package/geographiclib-geodesic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
