View source: R/midlines_polish.R
midlines_smooth | R Documentation |
Uses zoo{rollapply}
to smooth lines, while keeping nodes where lines meet unchanged. The dataset of ungrouped lines is returned.
midlines_smooth(x, width = 3)
x |
Feature collection of sf linestrings. The input is intended to be the output of |
width |
option passed to |
library(sf)
poly = st_buffer(st_linestring(matrix(c(0,0,10,0,10,10,0,10,0,0),ncol=2, byrow=TRUE) ),0.75)
plot(poly, col = "GRAY")
ml = midlines_clean(midlines_draw(poly, dfMaxLength = 1))
ml = ml[ml$removed_flag==0,]
plot(ml$geometry, add = TRUE)
ml_smooth = midlines_smooth(ml)
plot(poly, col = "GRAY")
plot(ml_smooth$geometry, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.