# @turf/bearing

> Takes two points and finds the geographic bearing between them.

Latest version **7.4.0** (published 2026-08-03) · MIT license · 2.3M weekly downloads

## Install

```sh
npm install @turf/bearing
pnpm add @turf/bearing
yarn add @turf/bearing
bun add @turf/bearing
```

## Health

**Score 100/100 (A)** — status: active.

Positive: high downloads; has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score; popular repo.

## Facts

| | |
|---|---|
| Version | 7.4.0 |
| Published | 2026-08-03 |
| First published | 2016-07-06 |
| Weekly downloads | 2.3M |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 10475 |
| Author | Turf Authors |
| Maintainers | rowanwins, tmcw, morganherlocker, tcql, mdfedderly, twelch, jamesmilneruk, morgan.herlocker |
| Keywords | turf, bearing |

## Links

- npm: https://www.npmjs.com/package/@turf/bearing
- Repository: https://github.com/Turfjs/turf
- Issues: https://github.com/Turfjs/turf/issues
- Funding: https://opencollective.com/turf
- npm.io page: https://npm.io/package/@turf/bearing

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [@turf/helpers](https://npm.io/package/@turf/helpers.md) 7.4.0
- [@types/geojson](https://npm.io/package/@types/geojson.md) ^7946.0.10
- [@turf/invariant](https://npm.io/package/@turf/invariant.md) 7.4.0

## Recent versions

- 7.4.0 (latest) — 2026-08-03
- 7.1.0-alpha.70 (prerelease) — 2024-08-09
- 3.5.2-alpha.d2c36ee7 (canary) — 2016-11-04
- 7.3.5 — 2026-04-19
- 7.3.4 — 2026-02-08
- 7.3.3 — 2026-01-28
- 7.3.2 — 2026-01-14
- 7.3.1 — 2025-11-27
- 7.3.0 — 2025-11-17
- 7.2.0 — 2024-12-29
- 7.1.0 — 2024-08-09
- 7.1.0-alpha.7 — 2024-06-25
- 7.0.0 — 2024-06-07
- 7.0.0-alpha.116 — 2024-05-07
- 7.0.0-alpha.115 — 2024-04-23
- … 46 more at https://npm.io/package/@turf/bearing/versions

## README

# @turf/bearing

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## bearing

Takes two [points][1] and finds the geographic bearing between them,
i.e. the angle measured in degrees from the north line (0 degrees)

### Parameters

*   `start` **[Coord][2]** starting Point
*   `end` **[Coord][2]** ending Point
*   `options` **[Object][3]** Optional parameters (optional, default `{}`)

    *   `options.final` **[boolean][4]** calculates the final bearing if true (optional, default `false`)

### Examples

```javascript
var point1 = turf.point([-75.343, 39.984]);
var point2 = turf.point([-75.534, 39.123]);

var bearing = turf.bearing(point1, point2);

//addToMap
var addToMap = [point1, point2]
point1.properties['marker-color'] = '#f00'
point2.properties['marker-color'] = '#0f0'
point1.properties.bearing = bearing
```

Returns **[number][5]** bearing in decimal degrees, between -180 and 180 degrees (positive clockwise)

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.1

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->

---

This module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.

### Installation

Install this single module individually:

```sh
$ npm install @turf/bearing
```

Or install the all-encompassing @turf/turf module that includes all modules as functions:

```sh
$ npm install @turf/turf
```

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