# turf-union

> find the union of geographic features

Latest version **3.0.12** (published 2016-07-05) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install turf-union
pnpm add turf-union
yarn add turf-union
bun add turf-union
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.12 |
| Published | 2016-07-05 |
| First published | 2014-05-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Morgan Herlocker |
| Maintainers | cspanring, cwmma, jseppi, jvrousseau, lyzidiamond, morganherlocker, mourner, tcql, tmcw |
| Keywords | turf, gif |

## Links

- npm: https://www.npmjs.com/package/turf-union
- Repository: https://github.com/Turfjs/turf-union
- Issues: https://github.com/Turfjs/turf-union/issues
- npm.io page: https://npm.io/package/turf-union

## Dependencies (1)

- [jsts](https://npm.io/package/jsts.md) 1.1.2

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.0.12 (latest) — 2016-07-05
- 3.0.7-canary.ae89c8b3 (canary) — 2016-06-14
- 3.0.10 — 2016-06-15
- 3.0.1 — 2016-05-16
- 3.0.0-canary.7879bf6c — 2016-05-16
- 3.0.0-canary.2f5f7167 — 2016-05-16
- 1.0.2 — 2015-03-24
- 1.0.1 — 2015-02-06
- 1.0.0 — 2014-12-11
- 0.0.1 — 2014-09-17
- 0.0.0 — 2014-05-29

## README

# turf-union

# union

Takes two [polygons](Polygon) and returns a combined polygon. If the input polygons are not contiguous, this function returns a [MultiPolygon](MultiPolygon) feature.

**Parameters**

-   `poly1` **Feature&lt;Polygon>** input polygon
-   `poly2` **Feature&lt;Polygon>** another input polygon

**Examples**

```javascript
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);

//=polygons

//=union
```

Returns **Feature&lt;(Polygon | MultiPolygon)>** a combined [Polygon](Polygon) or [MultiPolygon](MultiPolygon) feature

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install turf-union
```

Or install the Turf module that includes it as a function:

```sh
$ npm install turf
```

---
_Source: https://npm.io/package/turf-union · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
