turf icon indicating copy to clipboard operation
turf copied to clipboard

Line-Split does not split correctly

Open yeezussniper opened this issue 1 year ago • 6 comments

@turf/turf: 6.5.0

Line splitting does not occur, I have already seen issues Do you have any idea when this will be finalized? What could be a similar solution that bypasses the line-split function? Below is the code, thanks

const segmentToLineString = turf.lineString([
    [
        142.169574699565,
        48.9436348638413
    ],
    [
        142.1785775341235,
        48.945647760569
    ],
    [
        142.1945440538369,
        48.9451776295018
    ]
])
const intersectsPoint = turf.point([
    142.1785775341235,
    48.945647760569
])
console.log(turf.lineSplit(segmentToLineString, intersectsPoint)) // features.length = 1

yeezussniper avatar Oct 11 '23 14:10 yeezussniper

And under such conditions it is also an error:

const line = turf.lineString([
    [
        142.12974915391834,
        48.93984320346248
    ],
    [
        142.14927674756865,
        48.95258580753904
    ],
    [
        142.13301503194,
        48.94030032420335
    ]
])
const pt = turf.point([
    142.13567012301962,
    48.94067195388251
])
const isOnLine = turf.booleanPointOnLine(pt, line) // false (correct)
const intersects = turf.lineSplit(line, pt) // features.length = 2 (not correct)

yeezussniper avatar Oct 13 '23 06:10 yeezussniper

@yeezussniper did you find a solution to this? I just upgraded turf to version 7 and my tests started to fail. I think the output order is different, but not the results themself... Is it possible?

HarelM avatar Aug 21 '24 13:08 HarelM