Skip to content

booleanIntersects false positive for self-intersecting lines #2585

@kajkal

Description

@kajkal

The problem occurs in v7 alpha versions, in version 6.5.0 it works fine.

node.js example:

import assert from 'node:assert/strict';
import * as turf from '@turf/turf'; // v7.0.0-alpha.113

const result = turf.booleanIntersects({
    type: 'LineString',
    coordinates: [ [ 0, 1 ], [ 0, 3 ], [ 1, 3 ], [ 1, 2 ], [ 0, 2 ] ],
}, {
    type: 'Polygon',
    coordinates: [ [ [ 2, 3 ], [ 2, 2 ], [ 3, 2 ], [ 3, 3 ], [ 2, 3 ] ] ],
});
assert.equal(result, true);

browser example:

Playground jsfiddle.net

GeoJSON geojson.io

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions