Open
Description
The turf.difference function consistently returns incorrect results when checking the difference between to polygons.
The actual Result contains an extra point, which is wrong.
Steps to reproduce
- create polygons
const sourcePoly = turf.polygon([
[
[28, 0],
[40, 0],
[40, 40],
[29, 40],
[28, 0],
],
]);
const targetPoly = turf.polygon([
[
[40, 29],
[29, 29],
[29, 40],
[40, 40],
[40, 29],
],
]);
- log difference polygon
const difference= turf.difference(
turf.featureCollection([sourcePoly, targetPoly]),
);
Expected Output:
{
geometry: {
coordinates: [
[
[29, 0],
[40, 0],
[40, 29],
[29, 29],
[29, 0],
],
],
type: "Polygon",
},
properties: {},
type: "Feature",
},
Actual Result:
{
geometry: {
coordinates: [
[
[28, 0],
[40, 0],
[40, 29],
[29, 29],
[29, 40],
[28, 0],
],
],
type: "Polygon",
},
properties: {},
type: "Feature",
},
Environment
Turf.js version: 7.2.0
Metadata
Metadata
Assignees
Labels
No labels