geo icon indicating copy to clipboard operation
geo copied to clipboard

Line Slice

Open nevi-me opened this issue 5 years ago • 2 comments

Given a LineString, starting and ending Points, is it possible to slice the line from the start and end using the points?

nevi-me avatar Aug 20 '19 17:08 nevi-me

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]
);

frewsxcv avatar Aug 24 '19 12:08 frewsxcv

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.

nevi-me avatar Aug 25 '19 00:08 nevi-me