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

Make line_segment() vectorised #518

Closed
Robinlovelace opened this issue Aug 15, 2023 · 1 comment
Closed

Make line_segment() vectorised #518

Robinlovelace opened this issue Aug 15, 2023 · 1 comment

Comments

@Robinlovelace
Copy link
Member

Able to handle sf objects with more than 1 row, e.g. from docs:

#' l <- routes_fast_sf[2, ]
#' l_seg2 <- line_segment(l = l, n_segments = 2)
#' l_seg3 <- line_segment(l = l, n_segments = 3)
#' l_seg_100 <- line_segment(l = l, segment_length = 100)
#' l_seg_2000 <- line_segment(l = l, segment_length = 2000)
#' plot(sf::st_geometry(l_seg2), col = 1:2, lwd = 5)
#' plot(sf::st_geometry(l_seg3), col = 1:3, lwd = 5)
#' plot(sf::st_geometry(l_seg_100), col = seq(nrow(l_seg_100)), lwd = 5)
#' plot(sf::st_geometry(l_seg_2000), col = seq(nrow(l_seg_100)), lwd = 5)
#' # Multiple lines
#' l <- routes_fast_sf[2:4, ]
#' l_seg_multi = line_segment(l, segment_length = 1000)
Robinlovelace added a commit that referenced this issue Aug 15, 2023
@Robinlovelace
Copy link
Member Author

Demo of this in action 🎉

2023-08-15.22-02-12.mp4

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

No branches or pull requests

1 participant