From 6412bc19fb42e3f14347be9698f54eadbd429169 Mon Sep 17 00:00:00 2001 From: robinlovelace Date: Tue, 15 Aug 2023 17:28:51 +0100 Subject: [PATCH] Fix #514 --- R/linefuns.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/linefuns.R b/R/linefuns.R index e11174d3..b8ba0a2e 100644 --- a/R/linefuns.R +++ b/R/linefuns.R @@ -157,14 +157,12 @@ line_midpoint <- function(l, tolerance = NULL) { #' l_seg_100 <- line_segment(l = l, segment_length = 100) #' 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_seg3), col = 1:3) +#' plot(sf::st_geometry(l_seg_100), col = seq(nrow(l_seg_100))) line_segment <- function(l, n_segments, segment_length = NA) { if (!is.na(segment_length)) { - browser() - l_length <- sf::st_length(l) + l_length <- as.numeric(sf::st_length(l)) n_segments <- round(l_length / segment_length) } - # browser() # tests # first_linestring = lwgeom::st_linesubstring(x = l, from = 0, to = 0.2) from_to_sequence = seq(from = 0, to = 1, length.out = n_segments + 1) line_segment_list = lapply(seq(n_segments), function(i)