# turf-variance

> turf variance module

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

## Install

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

## 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, variance, stats, features |

## Links

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

## 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-12
- 0.1.2 — 2014-07-21
- 0.0.2 — 2014-06-03
- 0.0.1 — 2014-05-20

## README

# turf-variance

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

turf variance module


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

Calculates the variance value of a field for Point features within a set of Polygon features.


### Parameters

| parameter  | type              | description                             |
| ---------- | ----------------- | --------------------------------------- |
| `polygons` | FeatureCollection | a FeatureCollection of Polygon features |
| `points`   | FeatureCollection | a FeatureCollection of Point features   |
| `inField`  | string            | the field in input data to analyze      |
| `outField` | string            | the field in which to store results     |


### Example

```js
var polygons = turf.featurecollection([
  turf.polygon([[
    [-97.414398, 37.684092],
    [-97.414398, 37.731353],
    [-97.332344, 37.731353],
    [-97.332344, 37.684092],
    [-97.414398, 37.684092]
  ]]),
  turf.polygon([[
    [-97.333717, 37.606072],
    [-97.333717, 37.675397],
    [-97.237586, 37.675397],
    [-97.237586, 37.606072],
    [-97.333717, 37.606072]
  ]])
]);
var points = turf.featurecollection([
  turf.point([-97.401351, 37.719676], {population: 200}),
  turf.point([-97.355346, 37.706639], {population: 600}),
  turf.point([-97.387962, 37.70012], {population: 100}),
  turf.point([-97.301788, 37.66507], {population: 200}),
  turf.point([-97.265052, 37.643325], {population: 300})]);

var aggregated = turf.variance(
  polygons, points, 'population', 'variance');

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

//=result
```

## Installation

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

```sh
$ npm install turf-variance
```

## Tests

```sh
$ npm test
```

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