Learn R Programming

stplanr (version 0.6.2)

line_segment: Divide SpatialLines dataset into regular segments

Description

Divide SpatialLines dataset into regular segments

Usage

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

Other lines: angle_diff(), geo_toptail(), is_linepoint(), line2df(), line2points(), line_bearing(), line_match(), line_midpoint(), line_sample(), line_via(), mats2line(), n_sample_length(), n_vertices(), onewaygeo(), onewayid(), points2line(), toptail_buff(), toptailgs(), update_line_geometry()

Examples

Run this code
# NOT RUN {
data(routes_fast)
l <- routes_fast[2, ]
library(sp)
l_seg2 <- line_segment(l = l, n_segments = 2)
plot(l_seg2, col = l_seg2$group, lwd = 50)
# }

Run the code above in your browser using DataLab