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.119 to 0.0.120

lib/isClockwise.js

3

index.js
module.exports = {
isClockwise: require('./lib/isClockwise'),
area: require('./lib/area'),
near: require('./lib/near'),
isolines: require('./lib/isolines'),

@@ -3,0 +6,0 @@ isobands: require('./lib/isobands'),

@@ -1,1 +0,11 @@

//http://www.mathopenref.com/coordpolygonarea2.html
// use this https://github.com/mapbox/geojson-area
var _ = require('lodash')
module.exports = function(feature, done){
//transform geometries into x & y arrays
//foreach ring, add the area to an accumulating area sum
}

@@ -19,2 +19,3 @@ //https://github.com/jasondavies/conrec.js

t.tin(points, z, function(err, tinResult){
require('fs').writeFileSync(__dirname+'/../test/testOut/tinContour.geojson', JSON.stringify(tinResult))
t.extent(points, function(err, bbox){

@@ -33,9 +34,12 @@ t.square(bbox, function(err, bbox){

}
else {
//leave pt.properties null
}
})
})
if(!pt.properties){
//console.log(pt)
pt.properties = {}
pt.properties[z] = -100
}
})
require('fs').writeFileSync(__dirname+'/../test/testOut/contourGrid.geojson', JSON.stringify(gridResult))
var depth = Math.sqrt(gridResult.features.length)

@@ -62,2 +66,14 @@ for (var x=0; x<depth; x++){

//change zero breaks to .01 to deal with bug in conrec algorithm
breaks = _.map(breaks, function(num){
if(num === 0){
return .01
}
else{
return num
}
})
//deduplicate breaks
breaks = _.uniq(breaks)
var c = new Conrec

@@ -99,2 +115,6 @@ c.contour(data, 0, resolution, 0, resolution, xCoordinates, yCoordinates, breaks.length, breaks)

_.each(zGroups, function(group){
//console.log('===================================')
_.each(group.rings, function(ring){
//console.log(ring.geometry.coordinates)
})
t.merge(t.featurecollection(group.rings), function(err, multiRing){

@@ -101,0 +121,0 @@ donutPolys.features.push(multiRing)

2

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

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

@@ -17,2 +17,4 @@ turf

**NOTE: Browser functionality is currently unstable. Please consider using turf from node.js. Work is in progress on resolving the issues.**
```html

@@ -102,2 +104,3 @@ <script src="turf.min.js"></script>

- [combine](#combine)
- [isClockwise](#isClockwise)

@@ -366,2 +369,19 @@ **Planned Features**

###isClockwise
Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
```javascript
var t = require('turf')
var clockwiseRing = [[0,0],[1,1],[1,0],[0,0]]
var counterClockwiseRing = [[0,0],[1,0],[1,1],[0,0]]
var clockwise = t.isClockwise(clockwiseRing)
var counterClockwise = t.isClockwise(counterClockwiseRing)
console.log(clockwise) // true
console.log(counterClockwise) // false
```
###remove

@@ -368,0 +388,0 @@

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

describe('isobands', function(){
it('should take a set of points with z values and output a set of contour polygons', function(done){
xit('should take a set of points with z values and output a set of contour polygons', function(done){
t.load(__dirname+'/testIn/elevation1.geojson', function(err, points){

@@ -18,3 +18,3 @@ t.isobands(points, 'elevation', 15, [25, 45, 55, 65, 85, 95, 105, 120, 180], function(err, contours){

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

@@ -33,3 +33,3 @@ t.jenks(points, 'elevation', 5, function(err, breaks){

})
it('should take a set of points with decimal z values and output a set of contour polygons', function(done){
xit('should take a set of points with decimal z values and output a set of contour polygons', function(done){
t.load(__dirname+'/testIn/elevation2.geojson', function(err, points){

@@ -45,3 +45,3 @@ t.isobands(points, 'elevation', 15, [-1, 25, 45, 55, 65, 85, 95, 105, 120, 180], function(err, contours){

})
it('should take a set of points with negative z values and output a set of contour polygons', function(done){
xit('should take a set of points with negative z values and output a set of contour polygons', function(done){
t.load(__dirname+'/testIn/elevation3.geojson', function(err, points){

@@ -57,5 +57,5 @@ t.isobands(points, 'elevation', 15, [25, 45, 55, 65, 85, 95, 105, 120, 180], function(err, contours){

})
it('should take a set of points lopsided edges and output a set of contour polygons', function(done){
xit('should take a set of points lopsided edges and output a set of contour polygons', function(done){
t.load(__dirname+'/testIn/openContourPoints.geojson', function(err, points){
t.isobands(points, 'elevation', 15, [25, 45, 55, 65, 85, 95, 105, 120, 180], function(err, contours){
t.isobands(points, 'elevation', 15, [85, 95, 105, 120], function(err, contours){
if(err) throw err

@@ -71,5 +71,5 @@ //fs.writeFileSync(__dirname+'/testOut/contoursEdges.geojson', JSON.stringify(contours))

t.load(__dirname+'/testIn/holeContourPoints.geojson', function(err, points){
t.isobands(points, 'elevation', 15, [5, 15, 40, 80, 90, 110], function(err, contours){
t.isobands(points, 'elevation', 10, [0, 5, 15, 15,40, 40, 80, 90], function(err, contours){
if(err) throw err
//fs.writeFileSync(__dirname+'/testOut/contoursHoles.geojson', JSON.stringify(contours))
fs.writeFileSync(__dirname+'/testOut/contoursHoles.geojson', JSON.stringify(contours))
contours.should.be.ok

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

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc