1.0.1 • Published 9 years ago

turf-variance v1.0.1

Weekly downloads
1,433
License
MIT
Repository
github
Last release
9 years ago

turf-variance

build status

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

parametertypedescription
polygonsFeatureCollectiona FeatureCollection of Polygon features
pointsFeatureCollectiona FeatureCollection of Point features
inFieldstringthe field in input data to analyze
outFieldstringthe field in which to store results

Example

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.

$ npm install turf-variance

Tests

$ npm test
1.0.1

9 years ago

1.0.0

9 years ago

0.1.2

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago