Socket
Socket
Sign inDemoInstall

turf-union

Package Overview
Dependencies
2
Maintainers
8
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

npm-shrinkwrap.json

6

bench.js

@@ -5,3 +5,3 @@ var union = require('./');

var fcs = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/Intersect1.json'));
var fcs = JSON.parse(fs.readFileSync(__dirname+'/test/fixtures/in/Intersect1.geojson'));

@@ -17,4 +17,4 @@ var suite = new Benchmark.Suite('turf-union');

.on('complete', function () {
})
.run();
.run();

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

/**
* Takes two {@link Polygon} features and returnes a combined {@link Polygon} feature. If the input Polygon features are not contiguous, this function returns a {@link MultiPolygon} feature.
* Takes two {@link Polygon|polygons} and returns a combined polygon. If the input polygons are not contiguous, this function returns a {@link MultiPolygon} feature.
*
* @module turf/union
* @category transformation
* @param {Polygon} poly1 an input Polygon
* @param {Polygon} poly2 another input Polygon
* @return {Feature} a combined {@link Polygon} or {@link MultiPolygon} feature
* @param {Feature<Polygon>} poly1 input polygon
* @param {Feature<Polygon>} poly2 another input polygon
* @return {Feature<(Polygon|MultiPolygon)>} a combined {@link Polygon} or {@link MultiPolygon} feature
* @example

@@ -18,0 +18,0 @@ * var poly1 = {

{
"name": "turf-union",
"version": "1.0.1",
"version": "1.0.2",
"description": "find the union of geographic features",

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

@@ -10,3 +10,3 @@ # turf-union

Takes two polygons and combines them into one polgyon.
Takes two Polygon|polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature.

@@ -16,6 +16,6 @@

| parameter | type | description |
| --------- | ------- | --------------------- |
| `poly1` | Polygon | an input Polygon |
| `poly2` | Polygon | another input Polygon |
| parameter | type | description |
| --------- | -------------------- | --------------------- |
| `poly1` | Feature\.\<Polygon\> | input polygon |
| `poly2` | Feature\.\<Polygon\> | another input polygon |

@@ -26,23 +26,42 @@

```js
var poly1 = turf.polygon([[
[-82.574787, 35.594087],
[-82.574787, 35.615581],
[-82.545261, 35.615581],
[-82.545261, 35.594087],
[-82.574787, 35.594087]
]]);
poly1.properties.fill = '#0f0';
var poly2 = turf.polygon([[
[-82.560024, 35.585153],
[-82.560024, 35.602602],
[-82.52964, 35.602602],
[-82.52964, 35.585153],
[-82.560024, 35.585153]
]]);
poly2.properties.fill = '#00f';
var polyFC = turf.featurecollection([poly1, poly2]);
var poly1 = {
"type": "Feature",
"properties": {
"fill": "#0f0"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-82.574787, 35.594087],
[-82.574787, 35.615581],
[-82.545261, 35.615581],
[-82.545261, 35.594087],
[-82.574787, 35.594087]
]]
}
};
var poly2 = {
"type": "Feature",
"properties": {
"fill": "#00f"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-82.560024, 35.585153],
[-82.560024, 35.602602],
[-82.52964, 35.602602],
[-82.52964, 35.585153],
[-82.560024, 35.585153]
]]
}
};
var polygons = {
"type": "FeatureCollection",
"features": [poly1, poly2]
};
var union = turf.union(poly1, poly2);
//=polyFC
//=polygons

@@ -52,2 +71,5 @@ //=union

**Returns** `Feature.<Polygon|MultiPolygon>`, a combined Polygon or MultiPolygon feature
## Installation

@@ -67,1 +89,2 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc