# turf-erase

> erase features

Latest version **1.3.2** (published 2015-03-24) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.2 |
| Published | 2015-03-24 |
| First published | 2014-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | morganherlocker |
| Maintainers | tmcw, morganherlocker, mourner, jvrousseau, jseppi, cspanring, cwmma, lyzidiamond |
| Keywords | turf, gis |

## Links

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

## Dependencies (2)

- [jsts](https://npm.io/package/jsts.md) ~0.15.0
- [turf-featurecollection](https://npm.io/package/turf-featurecollection.md) ^1.0.0

## Recent versions

- 1.3.2 (latest) — 2015-03-24
- 1.3.1 — 2015-02-06
- 1.3.0 — 2014-12-10
- 1.2.0 — 2014-11-26
- 1.1.0 — 2014-11-14
- 0.1.3 — 2014-06-02
- 0.1.2 — 2014-06-02
- 0.1.1 — 2014-05-29
- 0.1.0 — 2014-05-29
- 0.0.0 — 2014-05-29

## README

# turf-erase

[![build status](https://secure.travis-ci.org/Turfjs/turf-erase.png)](http://travis-ci.org/Turfjs/turf-erase)

erase features


### `turf.erase(poly1, poly2)`

Finds the difference between two Polygon|polygons by clipping the second
polygon from the first.


### Parameters

| parameter | type                 | description                           |
| --------- | -------------------- | ------------------------------------- |
| `poly1`   | Feature\.\<Polygon\> | input Polygon feaure                  |
| `poly2`   | Feature\.\<Polygon\> | Polygon feature to erase from `poly1` |


### Example

```js
var poly1 = {
  "type": "Feature",
  "properties": {
    "fill": "#0f0"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.738586, -23.596711],
      [-46.738586, -23.458207],
      [-46.560058, -23.458207],
      [-46.560058, -23.596711],
      [-46.738586, -23.596711]
    ]]
  }
};
var poly2 = {
  "type": "Feature",
  "properties": {
    "fill": "#00f"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.650009, -23.631314],
      [-46.650009, -23.5237],
      [-46.509246, -23.5237],
      [-46.509246, -23.631314],
      [-46.650009, -23.631314]
    ]]
  }
};

var erased = turf.erase(poly1, poly2);
erased.properties.fill = '#f00';

var polygons = {
  "type": "FeatureCollection",
  "features": [poly1, poly2]
};

//=polygons

//=erased
```


**Returns** `Feature.<Polygon>`, a Polygon feature showing the area of `poly1` excluding the area of `poly2`

## Installation

Requires [nodejs](http://nodejs.org/).

```sh
$ npm install turf-erase
```

## Tests

```sh
$ npm test
```

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