开发者社区> 镜像站> NPM> turf-variance
turf-variance
turf variance module
Last updated 6 years ago by morganherlocker .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install turf-variance 
SYNC missed versions from official npm registry.

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

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

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

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

5 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Downloads
Today 0
This Week 5
This Month 5
Last Day 0
Last Week 0
Last Month 3
Dependencies (2)
Dev Dependencies (7)
Dependents (2)