Divide SpatialLines dataset into regular segments

line_segment(l, n_segments, segment_length = NA)

Arguments

l

A spatial lines object

n_segments

The number of segments to divide the line into

segment_length

The approximate length of segments in the output (overides n_segments if set)

See also

Examples

data(routes_fast) l <- routes_fast[2, ] library(sp) l_seg2 <- line_segment(l = l, n_segments = 2)
#> Transforming to CRS +proj=aeqd +lat_0=53.82911343 +lon_0=-1.52653966 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
#> Warning: CRS object has comment, which is lost in output
plot(l_seg2, col = l_seg2$group, lwd = 50)