turf-intersect
Advanced tools
Comparing version 0.0.0 to 1.0.0
33
index.js
// depend on jsts for now https://github.com/bjornharrtell/jsts/blob/master/examples/overlay.html | ||
var jsts = require('jsts') | ||
var featurecollection = require('turf-featurecollection') | ||
var jsts = require('jsts'); | ||
var featurecollection = require('turf-featurecollection'); | ||
module.exports = function(polys1, polys2){ | ||
if(polys1.type === 'FeatureCollection') { | ||
polys1 = polys1.features[0]; | ||
} else if(polys1.type !== 'Feature') { | ||
polys1 = { | ||
type: 'Feature', | ||
geometry: polys1 | ||
}; | ||
} | ||
if(polys2.type === 'FeatureCollection') { | ||
polys2 = polys2.features[0]; | ||
} else if(polys2.type !== 'Feature') { | ||
polys2 = { | ||
type: 'Feature', | ||
geometry: polys2 | ||
}; | ||
} | ||
var reader = new jsts.io.GeoJSONReader(), | ||
a = reader.read(JSON.stringify(polys1.features[0].geometry)), | ||
b = reader.read(JSON.stringify(polys2.features[0].geometry)), | ||
a = reader.read(JSON.stringify(polys1.geometry)), | ||
b = reader.read(JSON.stringify(polys2.geometry)), | ||
intersection = a.intersection(b), | ||
parser = new jsts.io.GeoJSONParser() | ||
parser = new jsts.io.GeoJSONParser(); | ||
intersection = parser.write(intersection) | ||
intersection = featurecollection([intersection]) | ||
intersection = parser.write(intersection); | ||
intersection = featurecollection([intersection]); | ||
return intersection; | ||
} | ||
} |
{ | ||
"name": "turf-intersect", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"description": "find the intersection of spatial features", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test/*.js" | ||
"test": "node test/test.js" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9052
306
0
1