Cut segment into sub-segment with a specific length
Source:R/TNETshape_cutSegments.R
TNETshape_cutSegments.Rd
This function will cut segment into sub-segments with a length betweem length_min
and 2*length_min
meter. Each segments and nodes created will have a unique ID.
Arguments
- path_segments
Path to the shapefile with segments to merge.
- path_node
Path to the shapefile with all segments nodes.
- export_segments
filename for the exported shapefile with segments created.
- export_node
filename for the exported shapefile with nodes created.
- length_min
minimum length of segments (m). Final segment length will be between
length_min
and2*length_min
.
Details
This function will cut all segments exceding \(2\times\text{length_min}\) meter into smaller segments with unique IDs. The ID of the most downstream created segments is kept identical to the Id of the original segment.
Here a figure resuming the computation done in this function:
The computation of cutting the segments is made by sf::st_line_sample()
, where we removed the first and last node to have not to small segments.
Examples
## Run directly the function providing all info
TNETshape_cutSegments(path_segments = "path/to/segments.shp",
path_node = "path/to/nodes.shp",
path_export = "path/to/exportFolder")
#> Error in TNETshape_cutSegments(path_segments = "path/to/segments.shp", path_node = "path/to/nodes.shp", path_export = "path/to/exportFolder"): unused argument (path_export = "path/to/exportFolder")