JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 113
  • Score
    100M100P100Q81805F
  • License MIT

erase features

Package Exports

  • turf-erase

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (turf-erase) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

turf-erase

build status

erase features

turf.erase(poly1, poly2)

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

Parameters

parameter type description
poly1 Polygon input Polygon feaure
poly2 Polygon Polygon feature to erase from poly1

Example

var poly1 = turf.polygon([[
 [-46.738586, -23.596711],
 [-46.738586, -23.458207],
 [-46.560058, -23.458207],
 [-46.560058, -23.596711],
 [-46.738586, -23.596711]
]]);
poly1.properties.fill = '#0f0';
var poly2 = turf.polygon([[
 [-46.650009, -23.631314],
 [-46.650009, -23.5237],
 [-46.509246, -23.5237],
 [-46.509246, -23.631314],
 [-46.650009, -23.631314]
]]);
poly2.properties.fill = '#00f';

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

var polygons = turf.featurecollection([poly1, poly2]);

//=polygons

//=erased

Installation

Requires nodejs.

$ npm install turf-erase

Tests

$ npm test