Comparing version 0.0.56 to 0.0.57
module.exports = { | ||
sample: require('./lib/sample'), | ||
jenks: require('./lib/jenks'), | ||
@@ -3,0 +4,0 @@ quantile: require('./lib/quantile'), |
{ | ||
"name": "turf", | ||
"version": "0.0.56", | ||
"version": "0.0.57", | ||
"description": "a node.js library for performing geospatial operations with geojson", | ||
@@ -32,3 +32,6 @@ "main": "index.js", | ||
"midpoint", | ||
"plane" | ||
"plane", | ||
"quantile", | ||
"jenks", | ||
"sample" | ||
], | ||
@@ -35,0 +38,0 @@ "author": "", |
@@ -53,2 +53,3 @@ turf | ||
- contour | ||
- sample | ||
@@ -59,2 +60,5 @@ **Planned Features** | ||
- interval | ||
- cluster | ||
- size | ||
- bezier | ||
@@ -66,3 +70,2 @@ - interpolate | ||
- intersect | ||
- reclass | ||
- remove | ||
@@ -72,2 +75,3 @@ - union | ||
- smooth | ||
- simplify | ||
@@ -494,2 +498,20 @@ - - - | ||
**sample** | ||
Takes a feature collection and returns N random features as a feature collection. | ||
```javascript | ||
var t = require('turf') | ||
var num = 10 | ||
t.load('./testIn/Points3.geojson', function(err, pts){ | ||
if(err) throw err | ||
t.sample(pts, num, function(err, outPts){ | ||
if(err) throw err | ||
console.log(outPts) | ||
}) | ||
}) | ||
``` | ||
- - - | ||
@@ -496,0 +518,0 @@ |
@@ -17,3 +17,3 @@ var t = require('../index'), | ||
outPts.features[0].geometry.type.should.equal('Point') | ||
t.save('./testOut/reclassed.geojson', outPts, 'geojson') | ||
t.save('./testOut/reclassed.geojson', outPts, 'geojson', function(){}) | ||
done() | ||
@@ -20,0 +20,0 @@ }) |
var t = require('../index'), | ||
should = require('should') | ||
should = require('should') | ||
describe('sample', function(){ | ||
xit('should output a random sample of points from a feature collection', function(done){ | ||
xit('should take a feature collection and a number and return a random sample of n length', function(done){ | ||
var num = 10 | ||
done() | ||
t.load('./testIn/Points3.geojson', function(err, pts){ | ||
if(err) throw err | ||
pts.should.be.ok | ||
t.sample(pts, num, function(err, outPts){ | ||
if(err) throw err | ||
outPts.should.be.ok | ||
outPts.features.length.should.equal(10) | ||
t.save('./testOut/sample.geojson', outPts, 'geojson', function(){}) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
982645
106
11715
566