midlines_dedensify: Removes points on lines between nodes

View source: R/midlines_polish.R

midlines_dedensifyR Documentation

Removes points on lines between nodes

Description

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.

Usage

midlines_dedensify(x, density)

Arguments

x

a feature collection of sf linestrings. The input is intended to be the output of midlines_clean

density

is the desired distance between points. This is passed to st_line_sample

Examples

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)

RichardPatterson/midlines documentation built on March 25, 2024, 1:38 a.m.