Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

booleanIntersects false positive for self-intersecting lines #2585

Open
kajkal opened this issue Mar 6, 2024 · 2 comments
Open

booleanIntersects false positive for self-intersecting lines #2585

kajkal opened this issue Mar 6, 2024 · 2 comments

Comments

@kajkal
Copy link

kajkal commented Mar 6, 2024

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

@smallsaucepan smallsaucepan changed the title turf.booleanIntersects false positive for self-intersecting lines booleanIntersects false positive for self-intersecting lines Mar 11, 2024
@bagusindrayana
Copy link

i have same issue, but my problem only happen if i using minify version of geojson, if i use detailed version like 6 digit coordinate precision there no problem, only have this problem when using coordinate precision less than 6

@bagusindrayana
Copy link

i have same issue, but my problem only happen if i using minify version of geojson, if i use detailed version like 6 digit coordinate precision there no problem, only have this problem when using coordinate precision less than 6

but sometime is work, only spesific MultiPolygon data that not work, example : https://jsfiddle.net/bagusindrayana/69z5xgah/

check if circle intersect with region (there 2, with minify version and detailed one)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants