Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/union

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/union - npm Package Compare versions

Comparing version 3.0.18 to 3.2.0

22

index.js

@@ -9,7 +9,6 @@ // look here for help http://svn.osgeo.org/grass/grass/branches/releasebranch_6_4/vector/v.overlay/main.c

/**
* Takes two {@link Polygon|polygons} and returns a combined polygon. If the input polygons are not contiguous, this function returns a {@link MultiPolygon} feature.
* Takes two or more {@link Polygon|polygons} and returns a combined polygon. If the input polygons are not contiguous, this function returns a {@link MultiPolygon} feature.
*
* @name union
* @param {Feature<Polygon>} poly1 input polygon
* @param {Feature<Polygon>} poly2 another input polygon
* @param {...Feature<Polygon>} A polygon to combine
* @return {Feature<(Polygon|MultiPolygon)>} a combined {@link Polygon} or {@link MultiPolygon} feature

@@ -60,15 +59,18 @@ * @example

*/
module.exports = function (poly1, poly2) {
module.exports = function () {
var reader = new jsts.io.GeoJSONReader();
var a = reader.read(JSON.stringify(poly1.geometry));
var b = reader.read(JSON.stringify(poly2.geometry));
var union = a.union(b);
var result = reader.read(JSON.stringify(arguments[0].geometry));
for (var i = 1; i < arguments.length; i++) {
result = result.union(reader.read(JSON.stringify(arguments[i].geometry)));
}
var writer = new jsts.io.GeoJSONWriter();
result = writer.write(result);
union = writer.write(union);
return {
type: 'Feature',
geometry: union,
properties: poly1.properties
geometry: result,
properties: arguments[0].properties
};
};
{
"name": "@turf/union",
"version": "3.0.18",
"version": "3.2.0",
"description": "find the union of geographic features",

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

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