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

turf-deviation

build status

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

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.

$ npm install turf-deviation

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.0                                ...           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 6
Dependencies (2)
Dev Dependencies (7)
Dependents (2)