Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Slice #378

Open
nevi-me opened this issue Aug 20, 2019 · 2 comments
Open

Line Slice #378

nevi-me opened this issue Aug 20, 2019 · 2 comments

Comments

@nevi-me
Copy link

nevi-me commented Aug 20, 2019

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

@frewsxcv
Copy link
Member

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

@nevi-me
Copy link
Author

nevi-me commented Aug 25, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants