# turf-deviation

> turf deviation module

Latest version **1.0.1** (published 2015-02-06) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-02-06 |
| First published | 2014-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | morganherlocker |
| Maintainers | morganherlocker, mourner, jvrousseau, jseppi, cspanring, cwmma, lyzidiamond, tmcw |
| Keywords | turf, geojson, standard, deviation, stats |

## Links

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

## Dependencies (2)

- [turf-inside](https://npm.io/package/turf-inside.md) ^1.1.3
- [simple-statistics](https://npm.io/package/simple-statistics.md) ^0.9.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-02-06
- 1.0.0 — 2014-12-11
- 0.1.0 — 2014-07-01
- 0.0.2 — 2014-05-30
- 0.0.1 — 2014-05-20

## README

# turf-deviation

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

turf deviation module


### `turf.deviation(polygons, points, inField, outField)`

Calculates the standard deviation value of a field for points within a set of polygons.


### Parameters

| parameter  | type              | description                                              |
| ---------- | ----------------- | -------------------------------------------------------- |
| `polygons` | FeatureCollection | a FeatureCollection of Polygon features                  |
| `points`   | FeatureCollection | a FeatureCollection of Point features                    |
| `inField`  | String            | the field in `points` from which to aggregate            |
| `outField` | String            | the field to append to `polygons` representing deviation |


### Example

```js
var polygons = turf.featurecollection([
  turf.polygon([[
    [-97.807159, 30.270335],
    [-97.807159, 30.369913],
    [-97.612838, 30.369913],
    [-97.612838, 30.270335],
    [-97.807159, 30.270335]
  ]]),
  turf.polygon([[
    [-97.825698, 30.175405],
    [-97.825698, 30.264404],
    [-97.630691, 30.264404],
    [-97.630691, 30.175405],
    [-97.825698, 30.175405]
  ]])
]);
var points = turf.featurecollection([
  turf.point([-97.709655, 30.311245],
    {population: 500}),
  turf.point([-97.766647, 30.345028],
    {population: 400}),
  turf.point([-97.765274, 30.294646],
    {population: 600}),
  turf.point([-97.753601, 30.216355],
    {population: 500}),
  turf.point([-97.667083, 30.208047],
  {population: 200})
]);

var inField = 'population';
var outField = 'pop_deviation';

var deviated = turf.deviation(
  polygons, points, inField, outField);

var result = turf.featurecollection(
  points.features.concat(deviated.features));

//=result
```

## Installation

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

```sh
$ npm install turf-deviation
```

## Tests

```sh
$ npm test
```

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