package
Finds the difference between multiple polygons by clipping the subsequent polygon from the first.
npm install @turf/differenceGitHub-flavored package documentation.
Across all versions, last 30 days.
11,275,916 in 30 days
Runtime metadata.
Tagged topics.
Finds the difference between multiple polygons by clipping the subsequent polygon from the first.
features FeatureCollection<(Polygon | MultiPolygon)> input Polygon featuresvar polygon1 = turf.polygon([[
[128, -26],
[141, -26],
[141, -21],
[128, -21],
[128, -26]
]], {
"fill": "#F00",
"fill-opacity": 0.1
});
var polygon2 = turf.polygon([[
[126, -28],
[140, -28
Returns (Feature<(Polygon | MultiPolygon)> | null) a Polygon or MultiPolygon feature showing the area of polygon1 excluding the area of polygon2 (if empty returns null)
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/differenceOr install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turftmcw
tom@macwright.com
Estimated unpacked size across 8 packages.
1.6 MB
Includes dependencies.
5 direct dependencies.
^2.8.1
2.9.1
7.4.0
7.4.0
^0.16.8
0.16.8
7.4.0
7.4.0
^7946.0.10
7946.0.16