Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf - npm Package Compare versions

Comparing version 0.0.84 to 0.0.86

lib/variance.js

1

index.js
module.exports = {
variance: require('./lib/variance'),
deviation: require('./lib/deviation'),

@@ -3,0 +4,0 @@ median: require('./lib/median'),

@@ -9,2 +9,3 @@ var _ = require('lodash')

t.deviation = require('./deviation')
t.variance = require('./variance')

@@ -44,2 +45,7 @@ module.exports = function(polygons, points, aggregations, done){

break
case 'variance':
t.variance(polygons, points, agg.inField, agg.outField, function(err, varianced){
polygons = varianced
})
break
default:

@@ -46,0 +52,0 @@ done(new Error('"'+agg.aggregation +'" is not a recognized aggregation operation.'))

2

package.json
{
"name": "turf",
"version": "0.0.84",
"version": "0.0.86",
"description": "a node.js library for performing geospatial operations with geojson",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -73,2 +73,3 @@ turf

- [deviation](#deviation)
- [variance](#variance)
- [aggregate](#aggregate)

@@ -844,2 +845,28 @@ - [union](#union)

###variance
Calculates the standard deviation value of a field for points within a set of polygons.
```javascript
var t = require('turf')
var poly1 = t.polygon([[[0,0],[10,0],[10,10], [0,10]]])
var poly2 = t.polygon([[[10,0],[20,10],[20,20], [20,0]]])
var polyFC = t.featurecollection([poly1, poly2])
var pt1 = t.point(1,1, {population: 500})
var pt2 = t.point(1,3, {population: 400})
var pt3 = t.point(14,2, {population: 600})
var pt4 = t.point(13,1, {population: 500})
var pt5 = t.point(19,7, {population: 200})
var ptFC = t.featurecollection([pt1, pt2, pt3, pt4, pt5])
t.variance(polyFC, ptFC, 'population', 'pop_variance', function(err, varianced){
if(err) throw err
console.log(varianced.features[0].properties.pop_variance)
console.log(varianced.features[1].properties.pop_variance)
})
```
###aggregate

@@ -891,2 +918,7 @@

outField: 'pop_deviation'
},
{
aggregation: 'variance',
inField: 'population',
outField: 'pop_variance'
}

@@ -893,0 +925,0 @@ ]

@@ -45,2 +45,7 @@ var t = require('../index'),

outField: 'pop_deviation'
},
{
aggregation: 'variance',
inField: 'population',
outField: 'pop_variance'
}

@@ -65,2 +70,4 @@ ]

polys.features[1].properties.pop_deviation.should.be.ok
polys.features[0].properties.pop_variance.should.be.ok
polys.features[1].properties.pop_variance.should.be.ok
done()

@@ -67,0 +74,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc