Socket
Socket
Sign inDemoInstall

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.89 to 0.0.90

lib/count.js

1

index.js
module.exports = {
count: require('./lib/count'),
erase: require('./lib/erase'),

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

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

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

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

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

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

2

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

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

@@ -79,2 +79,3 @@ turf

- [max](#max)
- [count](#count)
- [deviation](#deviation)

@@ -834,2 +835,28 @@ - [variance](#variance)

###count
Calculates the count of 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.count(polyFC, ptFC, 'population', 'point_count', function(err, counted){
if(err) throw err
console.log(counted.features[0].properties.point_count) // 2
console.log(counted.features[1].properties.point_count) // 3
})
```
###deviation

@@ -836,0 +863,0 @@

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

outField: 'pop_variance'
},
{
aggregation: 'count',
inField: '*',
outField: 'point_count'
}

@@ -52,0 +57,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