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.97 to 0.0.99

test/testOut/bufferedPoints.geojson

15

lib/buffer.js

@@ -11,2 +11,3 @@ //http://stackoverflow.com/questions/839899/how-do-i-calculate-a-point-on-a-circles-circumference

t.polygon = require('./polygon')
t.combine = require('./combine')

@@ -25,2 +26,13 @@ module.exports = function(feature, radius, units, union, done){

if(feature.type === 'FeatureCollection'){
t.combine(feature, function(err, multi){
bufferOp(multi, radius, done)
})
}
else{
bufferOp(feature, radius, done)
}
}
var bufferOp = function(feature, radius, done){
var reader = new jsts.io.GeoJSONReader()

@@ -34,2 +46,3 @@ var geom = reader.read(JSON.stringify(feature.geometry))

done(null, buffered)
}
}

@@ -6,8 +6,18 @@ // 1. run tin on points

t.tin = require('./tin')
t.topo
t.merge = require('./merge')
t.buffer = require('./buffer')
module.exports = function(points, done){
t.tin(points, function(err, tinPolys){
t.tin(points, null, function(err, tinPolys){
if(err) done(err)
//console.log(tinPolys)
t.buffer(tinPolys, .0001, 'miles', function(err, bufferPolys){
console.log(bufferPolys)
t.merge(bufferPolys, function(err, mergePolys){
if(err) done(err)
console.log(JSON.stringify(mergePolys, null, 2))
done(null, mergePolys)
})
})
})
}

34

lib/tin.js

@@ -30,20 +30,22 @@ //http://en.wikipedia.org/wiki/Delaunay_triangulation

})
// add values from vertices
_.each(triangles.features, function(tri){
var coordinateNumber = 1
_.each(tri.geometry.coordinates[0], function(c){
t.nearest(t.point(c[0], c[1]), points, function(err, closest){
if(coordinateNumber === 1){
tri.properties.a = closest.properties[z]
}
else if(coordinateNumber === 2){
tri.properties.b = closest.properties[z]
}
else if(coordinateNumber === 3){
tri.properties.c = closest.properties[z]
}
coordinateNumber++
if(z){
// add values from vertices
_.each(triangles.features, function(tri){
var coordinateNumber = 1
_.each(tri.geometry.coordinates[0], function(c){
t.nearest(t.point(c[0], c[1]), points, function(err, closest){
if(coordinateNumber === 1){
tri.properties.a = closest.properties[z]
}
else if(coordinateNumber === 2){
tri.properties.b = closest.properties[z]
}
else if(coordinateNumber === 3){
tri.properties.c = closest.properties[z]
}
coordinateNumber++
})
})
})
})
}
done(null, triangles)

@@ -50,0 +52,0 @@ }

{
"name": "turf",
"version": "0.0.97",
"version": "0.0.99",
"description": "a node.js library for performing geospatial operations with geojson",

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

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

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

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

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

hull.should.be.ok
hull.features.should.be.ok
console.log(hull)
//hull.features.should.be.ok
done()

@@ -15,0 +16,0 @@ })

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

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

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

@@ -18,2 +18,14 @@ var t = require('../index'),

})
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.tin(points, null, function(err, tin){
if(err) throw err
tin.should.be.ok
tin.features[0].geometry.type.should.equal('Polygon')
tin.features[0].geometry.coordinates.should.be.ok
fs.writeFileSync('./testOut/tin2.geojson',JSON.stringify(tin))
done()
})
})
})
})

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