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.111 to 0.0.112

5

package.json
{
"name": "turf",
"version": "0.0.111",
"version": "0.0.112",
"description": "a node.js library for performing geospatial operations with geojson",
"main": "index.js",
"scripts": {
"test": "mocha ./test/*"
},
"repository": {

@@ -7,0 +10,0 @@ "type": "git",

2

test/bezier.js

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

it('should take a line and return a smoothed version of the line', function(done){
t.load('./testIn/bezierIn.geojson', function(err, lineIn){
t.load(__dirname+'/testIn/bezierIn.geojson', function(err, lineIn){
if(err) throw err

@@ -10,0 +10,0 @@ t.bezier(lineIn, 5000, .85, function(err, lineOut){

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should buffer a Point', function(done){
t.load('../test/testIn/Point1.geojson', function(err, pt){
t.load(__dirname+'/testIn/Point1.geojson', function(err, pt){
t.buffer(pt, 10, 'miles', function(err, buffered){

@@ -16,3 +16,3 @@ //fs.writeFileSync('./testOut/buffered.geojson',JSON.stringify(buffered))

it('should buffer a LineString', function(done){
t.load('../test/testIn/bezierIn.geojson', function(err, pt){
t.load(__dirname+'/testIn/bezierIn.geojson', function(err, pt){
t.buffer(pt, 10, 'miles', function(err, buffered){

@@ -26,3 +26,3 @@ //fs.writeFileSync('./testOut/bufferedLine.geojson',JSON.stringify(buffered))

it('should buffer a Polygon', function(done){
t.load('../test/testIn/bufferPolygonIn.geojson', function(err, pt){
t.load(__dirname+'/testIn/bufferPolygonIn.geojson', function(err, pt){
t.buffer(pt, 10, 'miles', function(err, buffered){

@@ -36,3 +36,3 @@ //fs.writeFileSync('./testOut/bufferedPolygon.geojson',JSON.stringify(buffered))

it('should buffer a set of Points', function(done){
t.load('../test/testIn/Point1.geojson', function(err, pt){
t.load(__dirname+'/testIn/Point1.geojson', function(err, pt){
t.buffer(pt, 10, 'miles', function(err, buffered){

@@ -46,5 +46,5 @@ //fs.writeFileSync('./testOut/buffered.geojson',JSON.stringify(buffered))

it('should buffer a set of Points and union them', function(done){
t.load('../test/testIn/elevation1.geojson', function(err, pts){
t.load(__dirname+'/testIn/elevation1.geojson', function(err, pts){
t.buffer(pts, 10, 'miles', function(err, buffered){
fs.writeFileSync('./testOut/bufferedPoints.geojson',JSON.stringify(buffered))
//fs.writeFileSync('./testOut/bufferedPoints.geojson',JSON.stringify(buffered))
if(err) throw err

@@ -51,0 +51,0 @@ done()

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

it('should return the proper center for a FeatureCollection', function(done){
t.load('../test/testIn/FeatureCollection.geojson', function(err, layer){
t.load(__dirname+'/testIn/FeatureCollection.geojson', function(err, layer){
if(err) throw err

@@ -10,0 +10,0 @@ t.center(layer, function(center){

@@ -9,6 +9,6 @@ var t = require('../index'),

t.load('../test/testIn/concaveIn2.geojson', function(err, points){
t.load(__dirname+'/testIn/concaveIn2.geojson', function(err, points){
t.concave(points, maxEdge, function(err, hull){
if(err) throw err
fs.writeFileSync('./testOut/concave.geojson', JSON.stringify(hull))
//fs.writeFileSync('./testOut/concave.geojson', JSON.stringify(hull))
hull.should.be.ok

@@ -15,0 +15,0 @@ done()

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

it('should take a set of points with z values and output a set of contour polygons', function(done){
t.load('../test/testIn/elevation1.geojson', function(err, points){
t.load(__dirname+'/testIn/elevation1.geojson', function(err, points){
t.contour(points, 'elevation', 15, [25, 45, 55, 65, 85, 95, 105, 120, 180], false, function(err, contours){
if(err) throw err
fs.writeFileSync('./testOut/contours1.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contours1.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -19,3 +19,3 @@ contours.features.should.be.ok

it('should take a set of points with z values and output a set of contour polygons with jenks breaks', function(done){
t.load('../test/testIn/elevation1.geojson', function(err, points){
t.load(__dirname+'/testIn/elevation1.geojson', function(err, points){
t.jenks(points, 'elevation', 5, function(err, breaks){

@@ -25,3 +25,3 @@ if(err) throw err

if(err) throw err
fs.writeFileSync('./testOut/contours2.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contours2.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -35,6 +35,6 @@ contours.features.should.be.ok

it('should take a set of points with decimal z values and output a set of contour polygons', function(done){
t.load('../test/testIn/elevation2.geojson', function(err, points){
t.load(__dirname+'/testIn/elevation2.geojson', function(err, points){
t.contour(points, 'elevation', 15, [-2000,-20, -5, -1, 0, 2, 5, 10, 20, 30, 500 ], false, function(err, contours){
if(err) throw err
fs.writeFileSync('./testOut/contours3.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contours3.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -47,6 +47,6 @@ contours.features.should.be.ok

it('should take a set of points with negative z values and output a set of contour polygons', function(done){
t.load('../test/testIn/elevation3.geojson', function(err, points){
t.load(__dirname+'/testIn/elevation3.geojson', function(err, points){
t.contour(points, 'elevation', 15, [25, 45, 55, 65, 85, 95, 105, 120, 180], false, function(err, contours){
if(err) throw err
fs.writeFileSync('./testOut/contours4.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contours4.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -62,3 +62,3 @@ contours.features.should.be.ok

if(err) throw err
fs.writeFileSync('./testOut/contoursEdges.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contoursEdges.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -74,3 +74,3 @@ contours.features.should.be.ok

if(err) throw err
fs.writeFileSync('./testOut/contoursHoles.geojson', JSON.stringify(contours))
//fs.writeFileSync('./testOut/contoursHoles.geojson', JSON.stringify(contours))
contours.should.be.ok

@@ -77,0 +77,0 @@ contours.features.should.be.ok

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

it('should take a set of points and return a convex hull polygon', function(done){
t.load('../test/testIn/elevation1.geojson', function(err, points){
t.load(__dirname+'/testIn/elevation1.geojson', function(err, points){
t.convex(points, function(err, hull){

@@ -18,3 +18,3 @@ if(err) throw err

it('should take a set of points and return a convex hull polygon', function(done){
t.load('../test/testIn/convexIn2.geojson', function(err, points){
t.load(__dirname+'/testIn/convexIn2.geojson', function(err, points){
t.convex(points, function(err, hull){

@@ -21,0 +21,0 @@ if(err) throw err

@@ -6,5 +6,5 @@ var t = require('../index'),

it('should return the distance between two points', function(done){
t.load('../test/testIn/Point1.geojson', function(err, point1){
t.load(__dirname+'/testIn/Point1.geojson', function(err, point1){
if(err) throw err
t.load('../test/testIn/Point2.geojson', function(err, point2){
t.load(__dirname+'/testIn/Point2.geojson', function(err, point2){
if(err) throw err

@@ -11,0 +11,0 @@ t.distance(point1, point2, 'miles', function(err, distance){

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

it('should take a set of polygons and return a set of donuts', function(done){
t.load('../test/testIn/donutsIn.geojson', function(err, donutsIn){
t.load(__dirname+'/testIn/donutsIn.geojson', function(err, donutsIn){
if(err) throw err
t.donuts(donutsIn, function(err, donuts){
if(err) throw err
fs.writeFileSync('./testOut/donuts.geojson', JSON.stringify(donuts))
//fs.writeFileSync('./testOut/donuts.geojson', JSON.stringify(donuts))
donuts.should.be.ok

@@ -22,7 +22,7 @@ donuts.features.should.be.ok

it('should take a set of polygons and return a set of donuts', function(done){
t.load('../test/testIn/donutsIn2.geojson', function(err, donutsIn){
t.load(__dirname+'/testIn/donutsIn2.geojson', function(err, donutsIn){
if(err) throw err
t.donuts(donutsIn, function(err, donuts){
if(err) throw err
fs.writeFileSync('./testOut/donuts2.geojson', JSON.stringify(donuts))
//fs.writeFileSync('./testOut/donuts2.geojson', JSON.stringify(donuts))
donuts.should.be.ok

@@ -36,7 +36,7 @@ donuts.features.should.be.ok

it('should take a set of polygons and return a set of donuts with a shared edge', function(done){
t.load('../test/testIn/donutsIn3.geojson', function(err, donutsIn){
t.load(__dirname+'/testIn/donutsIn3.geojson', function(err, donutsIn){
if(err) throw err
t.donuts(donutsIn, function(err, donuts){
if(err) throw err
fs.writeFileSync('./testOut/donuts3.geojson', JSON.stringify(donuts))
//fs.writeFileSync('./testOut/donuts3.geojson', JSON.stringify(donuts))
donuts.should.be.ok

@@ -43,0 +43,0 @@ donuts.features.should.be.ok

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should return a polygon that represents the bbox around a feature or feature collection.', function(done){
t.load('../test/testIn/FeatureCollection.geojson', function(err, features){
t.load(__dirname+'/testIn/FeatureCollection.geojson', function(err, features){
t.envelope(features, function(err, poly){

@@ -9,0 +9,0 @@ if(err) throw err

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should return the proper extent for a FeatureCollection', function(done){
t.load('../test/testIn/FeatureCollection.geojson', function(err, layer){
t.load(__dirname+'/testIn/FeatureCollection.geojson', function(err, layer){
if(err) throw err

@@ -20,3 +20,3 @@ t.extent(layer, function(err, extent){

it('should return the proper extent for a Point', function(done){
t.load('../test/testIn/Point.geojson', function(err, layer){
t.load(__dirname+'/testIn/Point.geojson', function(err, layer){
if(err) throw err

@@ -34,3 +34,3 @@ t.extent(layer, function(err, extent){

it('should return the proper extent for a Polygon', function(done){
t.load('../test/testIn/Polygon.geojson', function(err, layer){
t.load(__dirname+'/testIn/Polygon.geojson', function(err, layer){
if(err) throw err

@@ -48,3 +48,3 @@ t.extent(layer, function(err, extent){

it('should return the proper extent for a LineString', function(done){
t.load('../test/testIn/LineString.geojson', function(err, layer){
t.load(__dirname+'/testIn/LineString.geojson', function(err, layer){
if(err) throw err

@@ -62,3 +62,3 @@ t.extent(layer, function(err, extent){

it('should return the proper extent for a MultiLineString', function(done){
t.load('../test/testIn/MultiLineString.geojson', function(err, layer){
t.load(__dirname+'/testIn/MultiLineString.geojson', function(err, layer){
if(err) throw err

@@ -76,3 +76,3 @@ t.extent(layer, function(err, extent){

it('should return the proper extent for a MultiPolygon', function(done){
t.load('../test/testIn/MultiPolygon.geojson', function(err, layer){
t.load(__dirname+'/testIn/MultiPolygon.geojson', function(err, layer){
if(err) throw err

@@ -79,0 +79,0 @@ t.extent(layer, function(err, extent){

@@ -24,3 +24,3 @@ var t = require('../index'),

grid.features[0].geometry.coordinates[0].should.equal(-20)
fs.writeFileSync('./testOut/grid.geojson',JSON.stringify(grid))
//fs.writeFileSync('./testOut/grid.geojson',JSON.stringify(grid))
done()

@@ -27,0 +27,0 @@ })

var t = require('../index'),
should = require('should')
describe('quantile', function(){
describe('jenks', function(){
it('should take a set of points and an array of percentiles and return a list of quantile breaks', function(done){
var num = 10
t.load('./testIn/Points3.geojson', function(err, pts){
t.load(__dirname+'/testIn/Points3.geojson', function(err, pts){
if(err) throw err

@@ -10,0 +10,0 @@ pts.should.be.ok

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should load a geojson file ok', function(done){
t.load('../test/testIn/FeatureCollection.geojson', function(err, layer){
t.load(__dirname+'/testIn/FeatureCollection.geojson', function(err, layer){
if(err) throw err

@@ -9,0 +9,0 @@ layer.should.be.ok

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

it('should take a set of polygons and merge them into a single polygon', function(done){
t.load('../test/testIn/mergeIn.geojson', function(err, polygons){
t.load(__dirname+'/testIn/mergeIn.geojson', function(err, polygons){
t.merge(polygons, function(err, mergeOut){

@@ -18,6 +18,6 @@ if(err) throw err

it('should take a set of polygons sharing a border and merge them into a single polygon', function(done){
t.load('../test/testIn/mergeIn2.geojson', function(err, polygons){
t.load(__dirname+'/testIn/mergeIn2.geojson', function(err, polygons){
t.merge(polygons, function(err, mergeOut){
if(err) throw err
fs.writeFileSync('./testOut/merge2.geojson', JSON.stringify(mergeOut))
//fs.writeFileSync('./testOut/merge2.geojson', JSON.stringify(mergeOut))
mergeOut.should.be.ok

@@ -29,6 +29,6 @@ done()

xit('should take a set of polygons for all countries and create a set of continents', function(done){
t.load('../test/testIn/countries_simp.geojson', function(err, polygons){
t.load(__dirname+'/testIn/countries_simp.geojson', function(err, polygons){
t.merge(polygons, function(err, mergeOut){
if(err) throw err
fs.writeFileSync('./testOut/world.geojson', JSON.stringify(mergeOut))
//fs.writeFileSync('./testOut/world.geojson', JSON.stringify(mergeOut))
mergeOut.should.be.ok

@@ -35,0 +35,0 @@ done()

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

it('should should return the nearest point', function(done){
t.load('../test/testIn/Point1.geojson', function(err, inPoint){
t.load('../test/testIn/Points3.geojson', function(err, inFeatures){
t.load(__dirname+'/testIn/Point1.geojson', function(err, inPoint){
t.load(__dirname+'/testIn/Points3.geojson', function(err, inFeatures){
t.nearest(inPoint, inFeatures, function(err, outPoint){

@@ -11,0 +11,0 @@ if(err) throw err

@@ -8,4 +8,4 @@ //http://math.stackexchange.com/questions/28043/finding-the-z-value-on-a-plane-with-x-y-values

it('should return the z value of a point on a plane', function(done){
t.load('../test/testIn/Triangle.geojson', function(err, triangle){
t.load('../test/testIn/PlanePoint.geojson', function(err, point){
t.load(__dirname+'/testIn/Triangle.geojson', function(err, triangle){
t.load(__dirname+'/testIn/PlanePoint.geojson', function(err, point){
t.planepoint(point, triangle, function(err, z){

@@ -12,0 +12,0 @@ z.should.be.ok

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should take a set of points and an array of percentiles and return a list of quantile breaks', function(done){
t.load('./testIn/Points3.geojson', function(err, pts){
t.load(__dirname+'/testIn/Points3.geojson', function(err, pts){
if(err) throw err

@@ -9,0 +9,0 @@ pts.should.be.ok

@@ -10,3 +10,3 @@ var t = require('../index'),

t.load('./testIn/Points3.geojson', function(err, pts){
t.load(__dirname+'/testIn/Points3.geojson', function(err, pts){
if(err) throw err

@@ -18,3 +18,3 @@ pts.should.be.ok

outPts.features[0].geometry.type.should.equal('Point')
t.save('./testOut/reclassed.geojson', outPts, 'geojson', function(){})
t.save(__dirname+'/testOut/reclassed.geojson', outPts, 'geojson', function(){})
done()

@@ -21,0 +21,0 @@ })

@@ -8,3 +8,3 @@ var t = require('../index'),

t.load('./testIn/Points3.geojson', function(err, pts){
t.load(__dirname+'/testIn/Points3.geojson', function(err, pts){
if(err) throw err

@@ -11,0 +11,0 @@ pts.should.be.ok

@@ -6,3 +6,3 @@ var t = require('../index'),

it('should save out a feature to geojson.', function(done){
var path = './testOut/poly.geojson'
var path = __dirname+'/testOut/poly.geojson'
var poly = t.polygon([[[0,0], [1,0], [1,1],[0,1]]])

@@ -9,0 +9,0 @@ var type = 'geojson'

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

it('should simplify a featurecollection of complex polygon', function(done){
t.load('./testIn/complexPolygons.geojson', function(err, geo){
t.load(__dirname+'/testIn/complexPolygons.geojson', function(err, geo){
if(err) throw err

@@ -20,3 +20,3 @@ geo.should.be.ok

it('should simplify a featurecollection of complex linestrings', function(done){
t.load('./testIn/complexLines.geojson', function(err, geo){
t.load(__dirname+'/testIn/complexLines.geojson', function(err, geo){
if(err) throw err

@@ -33,3 +33,3 @@ geo.should.be.ok

it('should simplify a complex polygon', function(done){
t.load('./testIn/complexPolygon.geojson', function(err, geo){
t.load(__dirname+'/testIn/complexPolygon.geojson', function(err, geo){
if(err) throw err

@@ -46,3 +46,3 @@ geo.should.be.ok

it('should simplify a complex linestring', function(done){
t.load('./testIn/complexLine.geojson', function(err, geo){
t.load(__dirname+'/testIn/complexLine.geojson', function(err, geo){
if(err) throw err

@@ -49,0 +49,0 @@ geo.should.be.ok

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

it('should tag a point layer with a property from a polygon layer', function(done){
t.load('./testIn/tagPoints.geojson', function(err, points){
t.load(__dirname+'/testIn/tagPoints.geojson', function(err, points){
if(err) throw err
t.load('./testIn/tagPolygons.geojson', function(err, polygons){
t.load(__dirname+'/testIn/tagPolygons.geojson', function(err, polygons){
if(err) throw err

@@ -16,3 +16,3 @@ t.tag(points, polygons, 'polyID', 'containingPolyID', function(err, taggedPoints){

taggedPoints.features.should.be.ok
fs.writeFileSync('./testOut/taggedPoints.geojson', JSON.stringify(taggedPoints))
//fs.writeFileSync('./testOut/taggedPoints.geojson', JSON.stringify(taggedPoints))
done()

@@ -19,0 +19,0 @@ })

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

it('should create a TIN from a set of points', function(done){
t.load('../test/testIn/Points3.geojson', function(err, points){
t.load(__dirname+'/testIn/Points3.geojson', function(err, points){
t.tin(points, 'elevation', function(err, tin){

@@ -14,3 +14,3 @@ if(err) throw err

tin.features[0].geometry.coordinates.should.be.ok
fs.writeFileSync('./testOut/tin.geojson',JSON.stringify(tin))
//fs.writeFileSync('./testOut/tin.geojson',JSON.stringify(tin))
done()

@@ -21,3 +21,3 @@ })

it('should create a TIN from a set of points with a null z', function(done){
t.load('../test/testIn/Points3.geojson', function(err, points){
t.load(__dirname+'/testIn/Points3.geojson', function(err, points){
t.tin(points, null, function(err, tin){

@@ -28,3 +28,3 @@ if(err) throw err

tin.features[0].geometry.coordinates.should.be.ok
fs.writeFileSync('./testOut/tin2.geojson',JSON.stringify(tin))
//fs.writeFileSync('./testOut/tin2.geojson',JSON.stringify(tin))
done()

@@ -31,0 +31,0 @@ })

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

it('should take geojson and output topojson', function(done){
t.load('./testOut/contours.geojson', function(err, polys){
t.load(__dirname+'/testOut/contours.geojson', function(err, polys){
if(err) throw err

@@ -13,3 +13,3 @@ t.topo(polys, function(err, topoPolys){

topoPolys.should.be.ok
fs.writeFileSync('./testOut/topo.topojson', JSON.stringify(topoPolys))
//fs.writeFileSync('./testOut/topo.topojson', JSON.stringify(topoPolys))
done()

@@ -26,3 +26,3 @@ })

topoPolys.should.be.ok
fs.writeFileSync('./testOut/topo.topojson', JSON.stringify(topoPolys))
//fs.writeFileSync('./testOut/topo.topojson', JSON.stringify(topoPolys))
done()

@@ -29,0 +29,0 @@ })

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