Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript

Home Page:https://turfjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Line-Split does not split correctly

yeezussniper opened this issue · 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

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)