-
Notifications
You must be signed in to change notification settings - Fork 994
Closed
Labels
Description
On turf 6.3.0: lineSlice is very imprecise:
// Start with a line to slice
const line = {
"type": "Feature",
"properties": {
"index": 0
},
"geometry": {
"type": "LineString",
"coordinates": [
[
3.69140625,
51.72702815704774
],
[
-5.3173828125,
41.60722821271717
]
]
}
}
// The start point of the line (Just the first coordinate of the line)
const pointStart = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
3.69140625,
51.72702815704774
]
}
}
// The end point of our slice (obtained by intersecting the line with another line with lineIntersect(line, splitter) )
const pointEnd = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
0.31936718356317106,
47.93913163509963
]
}
}
// Double check that this point is on the line :
pointToLineDistance(point, segment, { units: "meters" }) < 0.001 ;
// true
// Now run lineSlice
lineSlice( pointStart, pointEnd, line )
// It returns this result:
{
"type": "Feature",
"properties": {
"index": 0
},
"geometry": {
"type": "LineString",
"coordinates": [
// The first coordinate is the start point, normal
[
3.69140625,
51.72702815704774
],
////////////////////////////////////////////////////////////////////////////////////
// The second coordinate below is VERY far
// from the slice point we asked for, even though we
// showed it was on the line
[
-0.13132027083960374,
47.4328630517935
]
// It should be this instead
// [
// 0.31936718356317106,
// 47.93913163509963
// ]
////////////////////////////////////////////////////////////////////////////////////
]
}
}Reactions are currently unavailable