Learn R Programming

stplanr (version 0.8.2)

toptail_buff: Clip the beginning and ends SpatialLines to the edge of SpatialPolygon borders

Description

Takes lines and removes the start and end point, to a distance determined by the nearest polygon border.

Usage

toptail_buff(l, buff, ...)

Arguments

l

An sf LINESTRING object

buff

An sf POLYGON object to act as the buffer

...

Arguments passed to rgeos::gBuffer()

See Also

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

Examples

Run this code
# NOT RUN {
l <- routes_fast_sf
buff <- zones_sf
r_toptail <- toptail_buff(l, buff)
nrow(l)
nrow(r_toptail)
plot(zones_sf$geometry)
plot(l$geometry, add = TRUE)
plot(r_toptail$geometry, lwd = 5, add = TRUE)
# }

Run the code above in your browser using DataLab