Description Usage Arguments Details Value Examples
View source: R/shapefile_utils.R
Reorder line segments after intersection
1 | reorder_segments(src, parts)
|
src |
original line sf polyline object |
parts |
intersected sf polygon object |
Very briefly modificied from Spacedman's solution on StackExchange: https://gis.stackexchange.com/questions/295806/r-turn-off-automatic-ordering-of-linestrings-when-applying-sfst-intersection
Re-ordered version of parts
1 2 3 4 5 6 7 8 9 | #-- Read in shapefiles
str <- read_sf(system.file("extdata", "MehlandHill2010_stream.shp", package = "pbjr"))
tri <- read_sf(system.file("extdata", "720_triangles.shp", package = "pbjr"))
# Intersect
tri_stream <- st_intersection(tri, str)
#-- st_intersection can mess up segment order - it uses the triangle ID # to determine the order
tri_stream <- reorder_segments(str, tri_stream)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.