# turf-distance

> turf distance module

Latest version **3.0.12** (published 2016-07-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install turf-distance
pnpm add turf-distance
yarn add turf-distance
bun add turf-distance
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.12 |
| Published | 2016-07-05 |
| First published | 2014-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | morganherlocker |
| Maintainers | cspanring, cwmma, jseppi, jvrousseau, lyzidiamond, morganherlocker, mourner, tcql, tmcw |
| Keywords | turf, distance, miles, km |

## Links

- npm: https://www.npmjs.com/package/turf-distance
- Repository: https://github.com/Turfjs/turf-distance
- Issues: https://github.com/Turfjs/turf-distance/issues
- npm.io page: https://npm.io/package/turf-distance

## Dependencies (2)

- [turf-helpers](https://npm.io/package/turf-helpers.md) ^3.0.12
- [turf-invariant](https://npm.io/package/turf-invariant.md) ^3.0.12

## Recent versions

- 3.0.12 (latest) — 2016-07-05
- 3.0.7-canary.ae89c8b3 (canary) — 2016-06-14
- 3.0.10 — 2016-06-15
- 3.0.5 — 2016-05-17
- 3.0.1 — 2016-05-16
- 3.0.0-canary.7879bf6c — 2016-05-16
- 3.0.0-canary.2f5f7167 — 2016-05-16
- 1.1.0 — 2016-01-06
- 1.0.1 — 2015-02-06
- 1.0.0 — 2014-12-11
- 0.1.5 — 2014-08-04
- 0.1.4 — 2014-07-14
- 0.1.3 — 2014-06-13
- 0.1.2 — 2014-05-30
- 0.1.1 — 2014-04-04
- … 1 more at https://npm.io/package/turf-distance/versions

## README

# DEPRECATED - replaced with [`@turf/distance`](https://github.com/Turfjs/turf/tree/master/packages/turf-distance)
# turf-distance

[![build status](https://secure.travis-ci.org/Turfjs/turf-distance.png)](http://travis-ci.org/Turfjs/turf-distance)

turf distance module


### `turf.distance(from, to, [units=kilometers])`

Calculates the distance between two Point|points in degrees, radians,
miles, or kilometers. This uses the
[Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula)
to account for global curvature.


### Parameters

| parameter            | type               | description                                               |
| -------------------- | ------------------ | --------------------------------------------------------- |
| `from`               | Feature\.\<Point\> | origin point                                              |
| `to`                 | Feature\.\<Point\> | destination point                                         |
| `[units=kilometers]` | String             | _optional:_ can be degrees, radians, miles, or kilometers |


### Example

```js
var point1 = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-75.343, 39.984]
  }
};
var point2 = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [-75.534, 39.123]
  }
};
var units = "miles";

var points = {
  "type": "FeatureCollection",
  "features": [point1, point2]
};

//=points

var distance = turf.distance(point1, point2, units);

//=distance
```


**Returns** `Number`, distance between the two points

## Installation

Requires [nodejs](http://nodejs.org/).

```sh
$ npm install turf-distance
```

## Tests

```sh
$ npm test
```

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