对于任何寻求解决此问题的人。您可以使用booleanOverlap来确定两个多边形是否相交。
const p0 = turf.polygon([[
[0, 0],
[0, 1],
[1, 1],
[1, 0],
[0, 0]
]]);
const p1 = turf.polygon([[
[0, 0],
[0, 2],
[0.5, 2],
[0.5, 0],
[0, 0]
]])
const p2 = turf.polygon([[
[-2, -2],
[-2, 2],
[2, 2],
[2, -2],
[-2, -2]
]])
const p3 = turf.polygon([[
[10, 10],
[10, 11],
[11, 11],
[12, 12],
[11, 10],
[10, 10]
]]);
console.log(turf.booleanOverlap(p0, p0)); // false
console.log(turf.booleanOverlap(p0, p1)); // ture
console.log(turf.booleanOverlap(p0, p2)); // false
console.log(turf.booleanOverlap(p0, p3)); // false