# @turf/line-distance

> turf line-distance module

Latest version **4.7.3** (published 2017-09-12) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install @turf/line-distance
pnpm add @turf/line-distance
yarn add @turf/line-distance
bun add @turf/line-distance
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.7.3 |
| Published | 2017-09-12 |
| First published | 2016-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10475 |
| Author | Turf Authors |
| Maintainers | deniscarriere, tcql, morganherlocker, tmcw |
| Keywords | turf, linestring, length, distance, units, gis |

## Links

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

## Dependencies (3)

- [@turf/meta](https://npm.io/package/@turf/meta.md) ^4.7.3
- [@turf/helpers](https://npm.io/package/@turf/helpers.md) ^4.7.3
- [@turf/distance](https://npm.io/package/@turf/distance.md) ^4.7.3

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 4.7.3 (latest) — 2017-09-12
- 4.7.1 (lerna-temp) — 2017-09-05
- 3.5.2-alpha.d2c36ee7 (canary) — 2016-11-04
- 4.7.0 — 2017-09-05
- 4.6.0 — 2017-08-02
- 4.5.2 — 2017-06-30
- 4.5.1 — 2017-06-30
- 4.4.0 — 2017-06-06
- 4.3.0 — 2017-05-12
- 4.2.0 — 2017-04-30
- 4.1.0 — 2017-04-10
- 4.0.2 — 2017-04-06
- 4.0.1 — 2017-04-05
- 4.0.0 — 2017-04-03
- 3.14.2 — 2017-03-26
- … 17 more at https://npm.io/package/@turf/line-distance/versions

## README

# @turf/line-distance

# lineDistance

Takes a [GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects) and measures its length in the specified units, [Point]((Multi)Point)'s distance are ignored.

**Parameters**

-   `geojson` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects) \| [Geometry](http://geojson.org/geojson-spec.html#geometry))** GeoJSON to measure
-   `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** can be degrees, radians, miles, or kilometers (optional, default `kilometers`)

**Examples**

```javascript
var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
var length = turf.lineDistance(line, 'miles');

//addToMap
var addToMap = [line];
line.properties.distance = length;
```

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** length of GeoJSON

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://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 module individually:

```sh
$ npm install @turf/line-distance
```

Or install the Turf module that includes it as a function:

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

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