View source: R/midlines_polish.R
midlines_dedensify | R Documentation |
Without modifying the nodes where lines meet, the midlines between these nodes have their number of points reduced (de-densified). This might be useful to reduce the size of the line collection. The intention is that a high density of points can be used to estimate the midlines but this can be reduced if desired. The dataset of ungrouped lines is returned.
midlines_dedensify(x, density)
x |
a feature collection of sf linestrings. The input is intended to be the output of |
density |
is the desired distance between points. This is 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_dedensified = midlines_dedensify(ml, density = 1)
plot(poly, col = "GRAY")
plot(ml_dedensified$geometry, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.