geo
geo copied to clipboard
Line Slice
Given a LineString
, starting and ending Point
s, is it possible to slice the line from the start and end using the points?
are you thinking something like this?
let ls = line_string![coord1, coord2, coord3, coord4, coord5];
assert_eq!(
line_string![coord2, coord3, coord4],
ls.slice(coord2, coord4) // or ls[coord2..=coord4]
);
Yes, and;
let ls = line_string![coord1, coord2, coord3, coord4, coord6];
assert_eq!(
line_string![coord2, coord3, coord4, coord5],
ls.slice(coord2, coord5)
);
Where coord5
doesn't exist as a point in the line, but is a segment between coord4
and coord6
.