Comparing version 0.0.95 to 0.0.97
module.exports = { | ||
merge: require('./lib/merge'), | ||
convex: require('./lib/convex'), | ||
donuts: require('./lib/donuts'), | ||
@@ -3,0 +5,0 @@ within: require('./lib/within'), |
@@ -10,11 +10,15 @@ // look here for help http://svn.osgeo.org/grass/grass/branches/releasebranch_6_4/vector/v.overlay/main.c | ||
module.exports = function(polys1, polys2, done){ | ||
module.exports = function(poly1, poly2, done){ | ||
var reader = new jsts.io.GeoJSONReader() | ||
var a = reader.read(JSON.stringify(polys1.features[0].geometry)) | ||
var b = reader.read(JSON.stringify(polys2.features[0].geometry)) | ||
var a = reader.read(JSON.stringify(poly1.geometry)) | ||
var b = reader.read(JSON.stringify(poly2.geometry)) | ||
var union = a.union(b); | ||
var parser = new jsts.io.GeoJSONParser() | ||
union = parser.write(union) | ||
union = t.featurecollection([union]) | ||
union = { | ||
type: 'Feature', | ||
geometry: union, | ||
properties: poly1.properties | ||
} | ||
done(null, union) | ||
} |
{ | ||
"name": "turf", | ||
"version": "0.0.95", | ||
"version": "0.0.97", | ||
"description": "a node.js library for performing geospatial operations with geojson", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -90,2 +90,3 @@ turf | ||
- [union](#union) | ||
- [merge](#merge) | ||
- [intersect](#intersect) | ||
@@ -1020,2 +1021,18 @@ - [erase](#erase) | ||
###merge | ||
Takes a feature collection of polygons and outputs a single merged polygon feature. | ||
```javascript | ||
var t = require('turf') | ||
t.load(__dirname + '/testIn/mergeIn.geojson', function(err, polys){ | ||
t.merge(polys, function(err, merged){ | ||
if(err) throw err | ||
console.log(unioned) | ||
}) | ||
}) | ||
``` | ||
###intersect | ||
@@ -1022,0 +1039,0 @@ |
@@ -9,5 +9,5 @@ var t = require('../index'), | ||
t.load(__dirname + '/testIn/Intersect2.geojson', function(err, polys2){ | ||
t.union(polys1, polys2, function(err, unioned){ | ||
t.union(polys1.features[0], polys2.features[0], function(err, unioned){ | ||
if(err) throw err | ||
unioned.features[0].should.be.ok | ||
unioned.should.be.ok | ||
fs.writeFileSync(__dirname + '/testOut/unioned.geojson', JSON.stringify(unioned)) | ||
@@ -14,0 +14,0 @@ 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
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
2954825
210
22990
1092
33